Skip to content

Instantly share code, notes, and snippets.

@KingOfBrian
Last active August 29, 2015 14:02
Show Gist options
  • Save KingOfBrian/776887f4876269402351 to your computer and use it in GitHub Desktop.
Save KingOfBrian/776887f4876269402351 to your computer and use it in GitHub Desktop.
Swift Class
import Foundation
class Foo {
func bar() {
println("Swift Hello, World!")
}
@objc
func baz() {
println("baz")
}
}
let f = Foo.init()
f.bar(); // This was inlined in release, direct function call in debug
f.baz(); // This calls 'objc_msgSend'
let a:AnyObject = f
a.baz() // Calls 'objc_msgSend'
//a.bar() -- compile error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment