一些常用的对象声明创建和方法调用的对比
1、声明数组对象
var array:NSMutableArray?
2、数组初始化和添加\获取对象并打印出来
self.array = NSMutableArray();
self.array!.addObject(object);
self.array!.objectAtIndex(0);
let count = self.array?.count;
println("count = %d",count);
3、方法调用
OC
[self setNaviBarTitle:@"XX"];
swift
self.setNaviBarTitle("XX");
4、颜色设置
OC
self.view.backgroundColor = [UIColorwhiteColor];
swiftself.view.backgroundColor =UIColor.redColor();
5、block
AFAppDotNetAPIClient.sharedClient().POST(nil,parameters:nil,success: {(task:NSURLSessionDataTask!,responseObject:AnyObject!)in
println("");
},
failure:{(task: NSURLSessionDataTask!,error:NSError!)in
});
UIView.transitionWithView(self, duration: 0.5, options: .TransitionFlipFromRight, animations: {
println("");
}, completion:
{ (Bool finished) -> Void in
})