- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
public class DialogBuilder: NSObject {
private var style: UIAlertControllerStyle
private var titleColor: UIColor?
/**
* initial DialogBuilder with UIAlertControllerStyle and for title color
*/
public init(style: UIAlertControllerStyle = .alert, titlecolor : UIColor?) {
self.style = style
if(titlecolor != nil)
{self.titleColor = titlecolor}
}
/**
* initial DialogBuilder with UIAlertControllerStyle
*/
public init(style: UIAlertControllerStyle = .alert) {
self.style = style
}
...
}
Кстати, а правда в свифте надо явно наследовать NSObject? Это само собой не очевидно?
А еще нахуя проверить if(titlecolor != nil) если он и так нулабл (вопросик в конце типа же нулабл?)
И если уж проверять, то просто if(titlecolor) (в обжси так можно было)
Кстати, а в свифтах осталось понятие designated initializer?
- осталось