Swift方法声明可选参数

声明

str2:String? = nil

如:

func test(str:String, str2:String? = nil){
}
test("哈哈");
test("哈哈", str2: "哈哈哈");
2023/05/12 posted in  iOS

查看Swift代码执行时间

func measure(title: String!, call: () -> Void) {
    let startTime = CACurrentMediaTime()
    call()
    let endTime = CACurrentMediaTime()
    if let title = title {
        print("\(title): ")
    }
    print("Time - \(endTime - startTime)")
 }
Read more   2023/05/12 posted in  iOS

Swift常用类库

awesome-swift

这里收集了一些常用的swift类库

https://github.com/matteocrippa/awesome-swift

awesome-ios

当然还有OC的

https://github.com/vsouza/awesome-ios

Read more   2023/05/12 posted in  iOS

CocoaPods制作篇

Update: 2015-04-10

上传podspec文件到CocoaPods官方仓库中的方式更改,原来的办法不可行,新的办法如下:
http://guides.cocoapods.org/making/getting-setup-with-trunk.html

First you need to register for trunk:

$ pod trunk register orta@cocoapods.org 'Orta Therox' --description='macbook air'
Then you should be able to do:

$ pod trunk push yourPodspec.podspec
I hope that answers your question - I'm afraid I don't speak Chinese so I'm relying on google translate.
Read more   2023/05/12 posted in  iOS

Swift方法声明可选参数

声明

str2:String? = nil

如:

func test(str:String, str2:String? = nil){
}
test("哈哈");
test("哈哈", str2: "哈哈哈");
2017/08/15 posted in  iOS

查看Swift代码执行时间

func measure(title: String!, call: () -> Void) {
    let startTime = CACurrentMediaTime()
    call()
    let endTime = CACurrentMediaTime()
    if let title = title {
        print("\(title): ")
    }
    print("Time - \(endTime - startTime)")
 }
Read more   2017/08/15 posted in  iOS

Swift常用类库

awesome-swift

这里收集了一些常用的swift类库

https://github.com/matteocrippa/awesome-swift

awesome-ios

当然还有OC的

https://github.com/vsouza/awesome-ios

Read more   2017/08/15 posted in  iOS

CocoaPods制作篇

Update: 2015-04-10

上传podspec文件到CocoaPods官方仓库中的方式更改,原来的办法不可行,新的办法如下:
http://guides.cocoapods.org/making/getting-setup-with-trunk.html

First you need to register for trunk:

$ pod trunk register orta@cocoapods.org 'Orta Therox' --description='macbook air'
Then you should be able to do:

$ pod trunk push yourPodspec.podspec
I hope that answers your question - I'm afraid I don't speak Chinese so I'm relying on google translate.
Read more   2017/08/15 posted in  iOS