My personal notes on
- Getting Started with XCode
- What’s new in XCode 11
- Debugging in Xcode 11
sessions from WWDC 2019.
// MARK: UISceneSession Lifecycle
.
Additionally, // MARK: -
adds a separation line similar to Jump Bar. See this SO answer
for Jump Bar visualization.When multiple source editors are open a button will appear on right of close button. You can click on the focus button to focus on a single editor making it take up the whole editor screen.
SwiftPM was introduced in WWDC 20181 but the integration at least to me seemed too cumbersome. Similar to SwiftUI, declarative syntax is preferred. C, C++, and Objective-C can be compiled in SwiftPM as well but, mixing languages with Swift in a target is not supported2.
swift build
to build your package.swift run
to run its executable products.swift test
to execute tests. Use --parallel
flag to execute tests in
parallel.swift package
for various non-build operations on the package. For example
init
to create a library package and init --type executable
for an
executable package.Swift Packages consists of products, dependencies, and targets.
Package.swift
manifest file is used to configure these parts.
Package.swift
file.Creating an executable package;
mkdir MyPackage && cd MyPackage
swift package init --type executable
The directory structure will be as the following;
├── Package.swift
├── README.md
├── Sources
│ └── MyPackage
│ └── Hello.swift
└── Tests
├── HelloTests
│ └── MyPackageTests.swift
└── XCTestManifests.swift
└── LinuxMain.swift
Now you can compile and run the executable template with swift run
.
This year we have fully integrated SwiftPM with XCode. You can use packages to build apps for all of the platforms.
This announcement was what I was looking for in WWDC 2019. The potential was there but it was hard to make use of SwiftPM because of the limitations before.
To add a package, navigate to the project editor and simply use Swift Packages tab.