class Hoge: NSObject { var name: String? var note: String? override func description() -> String { return "Name = \(self.name), Note = \(self.note)" } } ERROR Method does not override any method from its superclass
let i: Int = Int(1.0) let n: NSInteger = NSInteger(1.0) ! let f: Float = Float(100) let d: Double = Double(100) let g: CGFloat = CGFloat(100) SwiftͰεΧϥʔܕͷΩϟετͳ͍
let index: NSInteger = 1 let width: CGFloat = 100 let r = width * (CGFloat)index ! // => ERROR Consecutive statements on a line must be separated by ';' ObjCϥΠΫͳΩϟετͰ͖ͳ͍
let someObjects: [AnyObject] = [ Movie(name: "2001: A Space", director: "Stan"), Movie(name: "Moon", director: "Duncan Jones"), Movie(name: "Alien", director: "Ridley Scott") ] ! for object in someObjects { let movie = object as Movie // Type Casting ! println("Movie: '\(movie.name)', dir. \(movie.director)") } ิ ΦϒδΣΫτܕΩϟετՄೳ
let index: NSInteger = 1 let width: CGFloat = 100 let r1 = width * Float(index) ! // => ERROR Could not find an overload for '*' that accepts the supplied arguments CGFloatͱFloatͷԋࢉ
typealias NSInteger = Int ! ! let i: Int = 1 let n: NSInteger = 1 let x: CGFloat = 3 let y: Float = 3 let w = i + Int(x) + Int(y) // => OK let q = n + Int(x) + Int(y) // => OK ! if n == i { println("HERE!") // => OK }