Good news: Swift 4.2 is now available in Xcode 10 beta! This release updates important Swift 4.1 features and improves the language in preparation for ABI stability. 1. toggle() for Bool swift propose adding a mutating func toggle to Bool. It toggles the Bool. var isVisible = true print(isVisible.toggle()) // false 2. Adding in-place removeAll(where:) to the Standard Library It is common to want... Continue Reading →
Advertisements
Common method in Swift
1. Check for any field empty in NSDictionary class func checkforEmptyValueinDictioanty(dic:NSDictionary)-> Bool{ for (keyVal, dataVal) in dic { if (dataVal.length()==0){ println("\(keyVal): \(dataVal.length())") return false } ... Continue Reading →
Use HexColor in Swift as a color
Add it in your class extension UIColor { convenience init(red: Int, green: Int, blue: Int) { assert(red >= 0 && red <= 255, "Invalid red component") assert(green >= 0 && green <= 255, "Invalid green component") assert(blue >= 0 && blue <= 255, "Invalid blue... Continue Reading →