id和instancetype类型在swift中的转换
+(id)buttonWithType:(UIButtonType)buttonType
class func buttonWithType(buttonType: UIButtonType)-> AnyObject!
调用var button = UIButton.buttonWithType(UIButtonType.System)as UIButton
+(instancetype)stringWithCString:(const char *)cString encoding:(NSStringEncoding)enc
class func stringWithCString(cString: CString,encoding enc: UInt)-> Self!
var str = NSString.stringWithCString("foo",encoding: NSUTF8StringEncoding)
var cs = str.UTF8String
只要object-c返回id类型的 都要在后面加as 这样才能保证类型一致
转自http://www.myexception.cn/mobile/1746263.html