You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
// |
|
// DoublePickerViewModel.swift |
|
// Lookfit |
|
// |
|
// Created by lemo on 2018/6/5. |
|
// Copyright © 2020年 ecell. All rights reserved. |
|
// |
|
|
|
import UIKit |
|
|
|
class DoublePickerViewModel: NSObject { |
|
|
|
let dataSourceVariable = BehaviorRelay<[[String]]>(value: []) |
|
var dataSource = [[String]]() |
|
|
|
override init() { |
|
super.init() |
|
} |
|
|
|
init(type: Int = 0 ,types: Int = 0) { |
|
dataSource = [[String]]() |
|
if type != 0 { // 时间 |
|
let sitIntervals = (1...12).map{"\($0 * 30)"} |
|
let sitThresholds = (1...10).map{"\($0 * 100)"} |
|
dataSource.append(sitIntervals) |
|
dataSource.append(sitThresholds) |
|
}else { |
|
for _ in 0 ..< 2 { |
|
var hours = Array<String>() |
|
for index in 0 ..< 24 { |
|
hours.append(String.init(format: "%02d:00", index)) |
|
if types == 999 |
|
{ |
|
hours.append(String.init(format: "%02d:30", index)) |
|
} |
|
} |
|
dataSource.append(hours) |
|
} |
|
} |
|
dataSourceVariable.accept(dataSource) |
|
} |
|
|
|
}
|
|
|