This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func ifNotNil<T>(params: [T?], process: ([T])->Void) | |
{ | |
let nilParams = params.filter { $0 == nil } | |
if countElements(nilParams) == 0 | |
{ | |
process(params.map { $0! }) | |
} | |
} | |
func ifNotNil<T>(process: ([T])->Void, params:T?...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UISegmentedControl | |
{ | |
func makeMultiline(numberOfLines: Int) | |
{ | |
for segment in self.subviews | |
{ | |
let labels = segment.subviews.filter { $0 is UILabel } // [AnyObject] | |
labels.map { ($0 as UILabel).numberOfLines = numberOfLines } | |
} | |
} |