Top "Swift3" questions

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

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
round trip Swift number types to/from Data

With Swift 3 leaning towards Data instead of [UInt8], I'm trying to ferret out what the most efficient/idiomatic way to …

swift swift3 swift-data
How to check current thread in Swift 3?

How do I check which one is the current thread in Swift 3? In previous versions of Swift it was possible …

ios multithreading swift3 nsthread
"oldValue" and "newValue" default parameters names inside willSet / didSet unrecognized

I am currently writing Swift 3 code in Xcode 8. When using oldValue and newValue default parameters inside the willSet and didSet …

ios swift swift3
How to apply the type to a NSFetchRequest instance?

In Swift 2 the following code was working: let request = NSFetchRequest(entityName: String) but in Swift 3 it gives error: Generic parameter "…

swift core-data swift3
What does "% is unavailable: Use truncatingRemainder instead" mean?

I get the following error when using code for an extension, I'm not sure if they're asking to just use …

ios swift swift3 modulus
How to write Keyboard notifications in Swift 3

I'm trying to update this code to swift 3: NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillShow:"), name: UIKeyboardWillShowNotification, object: nil) NSNotificationCenter.…

ios swift swift3 nsnotificationcenter
JSONSerialization Invalid type in JSON write (_SwiftValue)

Why does the following code give me the error: Invalid type in JSON write (_SwiftValue). The error is thrown on …

alamofire swift3
How to build Swift 3 project on Xcode 9?

Xcode 9 Release Notes says that Swift 3 compilation is supported: One compiler for Swift 4 and Swift 3, Swift 4 and Swift 3 targets can …

ios xcode swift3 swift4 xcode9
How to get country code using NSLocale in Swift 3

Could you please help on how to get country code using NSLocale in Swift 3 ? This is the previous code I …

ios swift3 nslocale