Swift 2.0 – Binary Operator “|” cannot be applied to two UIUserNotificationType operands

I am trying to register my application for local notifications this way: UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Alert | UIUserNotificationType.Badge, categories: nil)) In Xcode 7 and Swift 2.0 – I get error Binary Operator “|” cannot be applied to two UIUserNotificationType operands. Please help me. 4 Answers 4

Swift: #warning equivalent

Does Swift have a #warning equivalent? It’s simply used to show a warning in Xcode’s own GUI I’m also interested in whether there’s a #error equivalent. Apple has said #pragma mark is coming soon, it could possibly be the same with this. 14 Answers 14

Flatten an Array of Arrays in Swift

Is there a counterpart in Swift to flatten in Scala, Xtend, Groovy, Ruby and co? var aofa = [[1,2,3],[4],[5,6,7,8,9]] aofa.flatten() // shall deliver [1,2,3,4,5,6,7,8,9] of course i could use reduce for that but that kinda sucks var flattened = aofa.reduce(Int[]()){ a,i in var b : Int[] = a b.extend(i) return b } 14 Answers 14

Binary operator ‘|’ cannot be applied to two UIViewAutoresizing operands

Getting this error in Swift 2.0. Binary operator ‘|’ cannot be applied to two UIViewAutoresizing operands Here is the code: let view = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 568)) addSubview(view) view.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight Any idea what can be the problem? 6 Answers 6

Wait until swift for loop with asynchronous network requests finishes executing

I would like a for in loop to send off a bunch of network requests to firebase, then pass the data to a new view controller once the the method finishes executing. Here is my code: var datesArray = [String: AnyObject]() for key in locationsArray { let ref = Firebase(url: “http://myfirebase.com/” + “\(key.0)”) ref.observeSingleEventOfType(.Value, withBlock: … Read more