Top "Swift2" questions

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

Whats the Swift animate WithDuration syntax?

I'm porting an older app over to Xcode 7 beta and I'm getting an error on my animations: Cannot invoke 'animateWithDuration' …

swift swift2 animatewithduration swift3 optionsettype
Resolving 'Failed to call designated initializer on NSManagedObject class'

I'm new to Swift and I'm trying to learn how to use Core Data. But I'm getting this error and …

core-data swift2
How to define initializers in a protocol extension?

protocol Car { var wheels : Int { get set} init(wheels: Int) } extension Car { init(wheels: Int) { self.wheels = wheels } } on self.…

swift initialization swift2 protocols swift-extensions
How to silence a warning in swift

I have a piece of code which is generating lots of warnings (deprecated API) Using clang* I could do #pragma …

swift pragma swift2
'Module was not compiled for testing' when using @testable

I'm trying to use Swift 2's new @testable declaration to expose my classes to the test target. However I'm getting …

ios swift unit-testing swift2
Swift 2.0 Sorting Array of Objects by Property

In Swift 2.0, how would you go about sorting an array of custom objects by a property? I know in Swift 1.2, …

ios swift sorting swift2
Nil is not compatible with expected argument type UIViewAnimationOptions

I just started programming and following a tutorial online I was unable to create this animation. Can anyone tell me …

ios uiview swift2
UIView.animateWithDuration in Swift 2.0?

Before explain my problem, it is important to say that I already implemented the suggestion made in this question and …

ios swift uiviewanimation swift2 xcode7
How do I call a button function when the button is not being pressed

I have an IBAction connected to a button, and I wanted to know if there is any way to run …

ios swift swift2 ibaction
Class-Only Protocols in Swift

I want some of my classes (not all) to conform using 'Class-Only Protocols' from docs. What I am doing is …

ios swift swift2 protocols