
Xcode is a complete developer tool set which can be used to create apps for Apple TV, Apple Watch, iPad, iPhone, and Mac environment. The development environment of Xcode bundles, Instruments for analysis, Simulator, and several OS frameworks.
Apple new release, Xcode 10 beta includes the beta SDKs for iOS 12, watchOS 5, tvOS 12, and macOS Mojave including Swift 4.2. The following are some of the prominent features in Xcode 10.
1. XCODEBUILD
The upcoming Xcode 10 launch includes the various command line tools which could be used to achieve tasks through scripts.
– Parallel Tests
Xcode 10 supports running tests in parallel, which reduces the time it takes to run tests. It’s possible to run the XCTest from the command line using the Xcode build tool. The following are some scripts for enabling parallel testing,
–maximum-concurrent-test-device-destinations : depicts maximum number of device destinations to test on concurrently
–maximum-concurrent-test-simulator-destinations : the maximum number of simulator destinations to test on parallel
–parallel-testing-enabled : indicates the per-target setting in the scheme
–parallel-testing-worker-count : exact number of test runners that will be spawned during parallel testing
–maximum-parallel-testing-workers : maximum number of test runners that will be spawned during parallel testing.
Sample code :
$ xcodebuild -project Xcode10-Demo.xcodeproj/ -scheme Xcode10-Demo 'platform=iOS Simulator,OS=12.0, name=iPhone X' clean build test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -parallel-testing-worker-count 4
The above command will start the execution concurrently in 4 clones of the iPhone X simulator.
– Upload App to App Store
It’s possible to upload an iOS app to App Store from the xcode build tool with Xcode 10 release. With the following command
$ xcodebuild -exportArchive -archivePath <xcarchivepath> [-exportPath <destinationpath>] -exportOptionsPlist <plistpath>
Along with executing the above command, We need to pass the ExportOptions.plist file which will contains the key destination. Xcode should be configured with membership details to connect to Apple developer portal.
2. Code Snippets
We can create custom code snippets in Xcode 10 and increase the reusability of the code. This is accessible from Xcode Editor menu — -> Create Code Snippet.
We can include snippets for other languages as well. e.g Ruby, YAML etc along shortcut key for the snippets.
3. Multi-Line Editing
Xcode10 include support for multi-line editing witch is depicted in below image. We can select multiple instances by holding CTRL+SHIFT and select required the spots.
4. Source Control Enhancements
In past WWDC, Apple has already announced tight integration with Github. Apple has now integrated more source control systems like Gitlab and BitBucket. Xcode developers will be able to resolve merge conflicts from the highlights in code. There is a extra interesting feature that allows the users to create ssh keys from Xcode and upload to the remote source control.
Developers can perform actions like discard changes, pull changes, rebase change straight from Xcode.
5. Dark Mode
Apple’s upcoming macOS Mojave, has a new dark interface which indeed brings dark mode to Xcode 10 environment. You can switch it on from Xcode System Preferences. Xcode 10 provides support with powerful tools for creating one’s own dark apps for macOS.
6. Asset Catalog
The asset catalog supports varying image and color by Light, Dark, and High Contrast appearances on the upcoming macOS 10.14 and above.
7. Build System
The new build system in Xcode 10 improves the reliability and the build performance. This system detects the project configuration problems which is neglected by the legacy build system. Developers can switch to the legacy build system in Xcode 10 by selecting system setting in File > Project/Workspace Settings sheet.
The above are some of the few high-level features of Xcode 10 in action those were announced at the WWDC 2018. As we progress through the WWDC session, we will cover the details of each topic in the later blog posts.
–
Poorvitha Y,
iOS Development Team,
Mallow Technologies.