Due to the constant updating of Swift syntax, different versions of XCode compilers detect that the syntax is not supported when compiling Swift files and checking the syntax. Such mistakes come out
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
what’s problem ?
The following build commands failed:CompileSwift normal armv7
xxx.swiftCompileSwiftSources normal arm64
com.apple.xcode.tools.swift.compilerCompileSwift normal arm64 xxx.swift
Copy the code
How happen ?
xxx.swift:24:10: error: consecutive statements on a line must be separated by '; '} completion: { _ in^; xxx.swift:24:21: error: expected expression} completion: { _ in^xxx.swift:24:11: error: use of unresolved identifier 'completion'} completion: { _ in^~~~~~~~~~xxx.swift:24:23: error: unable to infer closure type in the current context} completion: { _ in^~~~~~xxx.swift:24:23: error: closure expression is unused} completion: { _ inCopy the code
How fix ?
// Xcode12 and above uiViet. animate(withDuration: 0.3) {// Animation Actions} completion: {_ in // Some finished actions} // below xcode12 UIView.animate(withDuration: 0.3, animations: { // animation actions }, completion: { _ in // some finished actions })Copy the code
Why ?
The current stable version of Swift is 5.4
Docs.swift.org/swift-book/…
The Swift Language Version in build-setting of XCode new project is set to Swift5
Recently, SWIFT was used in the project development. The project could be normally compiled and run locally, but the following error was thrown when Jenkins was packing.
Analyze and summarize this problem, so that the students behind are not troubled by the same problem.
Refer to the XCode update documentation
Developer.apple.com/xcode/whats…
Swift5.3 and above was only introduced after XCode12
Swift5.3 Update
- Added information about multiple trailing closures to the Trailing Closures section, and added information about how trailing closures are matched to parameters to the Function Call Expression section.