Content preview
·Function or method parameters
When calling a function or method, you must specify the parameter name starting from the first parameter.
·Method return value
The return value of a method in Swift 3.0 must be received or a warning will be reported. Of course, the main purpose is to avoid developers forgetting to receive the return value. However, in some cases, there is no need to use the return value. You can use "_" to receive to ignore the return. value. Of course, you can also add the @discardableResult statement to tell the compiler that this method does not need to receive a return value.
·Selector changes
The change of Selector has actually gone through many changes from 1.0 to 3.0. From the earliest @Selector("method:") to the current #selector(method(param1:)), it can be said that it has gone through many modifications. Fortunately, it has become Getting better and better, after all string operations are very useless for syntax checking.
·Optional types
Swift 3.0 has stricter control over optional types. After the operation of implicit optional types and other types, the optional type is obtained instead of the implicit optional type.
·SDK class library changes
Everyone knows that Swift was born when Objective-C has developed quite maturely. In order to ensure that ObjC developers can smoothly transition to Swift, and because Swift is in its infancy, many class libraries and method naming are tried to be consistent with ObjC. The shadow of ObjC can be seen everywhere in the development of iOS applications with Swift. However, as a Modern language, Swift has made changes, which shows that Swift will completely get rid of the shadow of ObjC in the future. This includes re-importing Foundation to eliminate type prefixes, deduplication of method names, de-C style functions and methods, etc.
Tutorial preview
it works
it works
it works