Skip to content
95. 2. More Xcode and Swift, MVC  episode artwork

EPISODE · Sep 19, 2015 · 42 MIN

95. 2. More Xcode and Swift, MVC

from iOSDevLog · host iOSDevLog

Code: ​https://github.com/jiaxianhua/iOSDevLog ​ ​Error: ​http://stackoverflow.com/questions/29457720/compiler-error-method-with-objective-c-selector-conflicts-with-previous-declara ​ I myself is also taking the Standford course and I got stuck here for a long time too, but after some searching, I found something from here: Xcode release notes and it mentioned something below: Swift 1.2 is strict about checking type-based overloading of @objc methods and initializers, something not supported by Objective-C. // Has the Objective-C selector "performOperation:". func performOperation(op: NSOperation) { /* do something */ } // Also has the selector "performOperation:". func performOperation(fn: () -> Void) { self.performOperation(NSBlockOperation(block: fn)) } This code would work when invoked from Swift, but could easily crash if invoked from Objective-C. To solve this problem, use a type that is not supported by Objective-C to prevent the Swift compiler from exposing the member to the Objective-C runtime: If it makes sense, mark the member as private to disable inference of @objc. Otherwise, use a dummy parameter with a default value, for example: _ nonobjc: () = (). (19826275) Overrides of methods exposed to Objective-C in private subclasses are not inferred to be @objc, causing the Swift compiler to crash. Explicitly add the @objc attribute to any such overriding methods. (19935352) Symbols from SDKs are not available when using Open Quickly in a project or workspace that uses Swift. (20349540) what i did was just adding "private" in front of the override method like this: private func performOperation(operation: Double -> Double) { if operandStack.count >= 1 { displayValue = operation(operandStack.removeLast()) enter() } }

Episode metadata supplied by the publisher feed · Published Sep 19, 2015

Embed this episode

Ready to play

95. 2. More Xcode and Swift, MVC

0:00 42:45

No transcript for this episode yet

We transcribe on demand. Request one and we'll notify you when it's ready — usually under 10 minutes.

No similar episodes found.

No similar podcasts found.

Frequently Asked Questions

How long is this episode of iOSDevLog?

This episode is 42 minutes long.

When was this iOSDevLog episode published?

This episode was published on September 19, 2015.

Can I download this iOSDevLog episode?

Yes. Use the download control on the episode player to save the publisher-provided media file.
URL copied to clipboard!