Packages can now declare executable targets
About 2 min
Packages can now declare executable targets 관련
HACKING WITH SWIFT
What's new in Swift?
Packages can now declare executable targets | Changes in Swift 5.4
Packages can now declare executable targets
Available from Swift 5.4
SE-0294 (apple/swift-evolution
) adds a new target option for apps using Swift Package manager, allowing us to explicitly declare an executable target.
This is particularly important for folks who want to use SE-0281 (apple/swift-evolution
) (using @main
to mark your program’s entry point), because it didn’t play nicely with Swift Package Manager – it would always look for a main.swift
file.
With this change, we can now remove main.swift
and use @main
instead.
Note
You must specify // swift-tools-version:5.4
in your Package.swift
file in order to get this new functionality.
Other Changes in Swift 5.4
Improved implicit member syntax | Changes in Swift 5.4
Improved implicit member syntax
Multiple variadic parameters in functions | Changes in Swift 5.4
Multiple variadic parameters in functions
Local functions now support overloading | Changes in Swift 5.4
Local functions now support overloading
Creating variables that call a function of the same name | Changes in Swift 5.4
Creating variables that call a function of the same name
Result builders | Changes in Swift 5.4
Result builders
Property wrappers are now supported for local variables | Changes in Swift 5.4
Property wrappers are now supported for local variables