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

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

Swift’s guard keyword

Swift 2 introduced the guard keyword, which could be used to ensure that various data is configured ready to go. An example I saw on this website demonstrates an submitTapped function: func submitTapped() { guard username.text.characters.count > 0 else { return } print(“All good”) } I am wondering if using guard is any different than … Read more