precondition - ShenYj/ShenYj.github.io GitHub Wiki
在看 BulletinBoard
源码的时候看到了这个类似于断言的 api
precondition(condition:Bool,message:String)
func precondition(_ condition: @autoclosure () -> Bool, _ message: @autoclosure () -> String = String(), file: StaticString = #file, line: UInt = #line)
在使用上, precondition
在 debug
和 release
下都生效, 而 assert
只有在 debug
环境下生效