Top "Swift2" questions

Use this tag only for questions directly related to changes in version 2.x of Apple's Swift programming language.

Swift 2.0: Type of Expression is ambiguous without more context?

The following used to work in Swift 1.2: var recordSettings = [ AVFormatIDKey: kAudioFormatMPEG4AAC, AVEncoderAudioQualityKey : AVAudioQuality.Max.rawValue, AVEncoderBitRateKey : 320000, AVNumberOfChannelsKey: 2, AVSampleRateKey : 44100.0] Now, …

ios swift swift2 avfoundation xcode7
How to get the result value of Alamofire.request().responseJSON in swift 2?

I have a question about the new version of Alamofire for Swift 2 Alamofire.request(.POST, urlString, parameters: parameters as? [String : …

ios json swift swift2 alamofire
iOS. How to enable and disable rotation on each UIViewController?

I have an UIViewController, I want to disable or enable rotation of the screen in different scenarios Example: if flag { …

ios swift swift2
How do I check in Swift if two arrays contain the same elements regardless of the order in which those elements appear in?

Let's say there are two arrays... var array1 = ["a", "b", "c"] var array2 = ["b", "c", "a"] I'd like the result …

arrays swift swift2
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.…

ios swift swift2
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: …

ios swift cocoa-touch swift2
try, try! & try? what’s the difference, and when to use each?

In Swift 2.0, Apple introduced a new way to handle errors (do-try-catch). And few days ago in Beta 6 an even newer …

swift error-handling swift3 swift2
Trailing and Leading constraints in Swift programmatically (NSLayoutConstraints)

I'm adding from a xib a view into my ViewController. Then I'm putting its constraints to actually fit it override …

ios iphone swift2 nslayoutconstraint
Understanding Swift 2.2 Selector Syntax - #selector()

I am switching over the syntax of my project toward Swift 2.2 (which xCode helps me do automatically); however, I do …

swift swift2 selector
How can I build a URL with query parameters containing multiple values for the same key in Swift?

I am using AFNetworking in my iOS app and for all the GET requests it makes, I build the url …

ios swift swift2 nsurl