current position:Home>What's new in Xcode 14

What's new in Xcode 14

2022-06-24 09:29:26Small set

From year to year WWDC, In addition to releasing the latest iOS、iPadOS、watchOS、macOS Outside , Apple will also update Xcode. New version of the Xcode It brings a lot of new features , To adapt to new systems , At the same time, it provides more convenient tools to improve our development efficiency . Another important thing is ,Xcode 14 The initial package size has now been reduced to 7G+, comparison Xcode 13 Of 10G+, Less 30%, Of course , It is quite large after installation , therefore 128G Of mac Movies are not enough .

Usually Xcode Release Note They are all long articles , In addition to the new features , There are also known problems 、 Problems solved and other information . Let's sort out some important updates here , For developers' reference .

Universal

Xcode 14 Support single target Multi platform , And conditionally include platform specific dependencies 、 Code 、 Resources and build settings .

Xcode 14 Now support is iPadOS Development DriverKit The driver .

Xcode 14 Include a new watchOS Application default template , It will WatchKit Applications and WatchKit Application extension targets are combined into a single Watch Application target , This simplifies the code 、 Asset and localization management . At present, single objective can be watchOS Application deployment to watchOS 7 And higher .

Apple Clang compiler

stay Xcode New created in C++ Project default use C++20. 

Asset catalog

Use one 1024x1024 To simplify the application icon , The image is automatically resized for its target . Select the single size option in the property inspector of the application icon in the asset catalog . However, you can still use “ All sizes ” Option overrides a single size .

Now we can put Finder Paste the copied image in the asset catalog outline directly .

You can now double-click the image slot to display the open file panel and select replace asset .

You can specify the default rendering mode for custom symbols in the asset catalog . take “ Render as ” Property is set to automatic 、 Templates 、 Multicolor or layered . Then the system uses the default rendering mode of the symbol , Unless you explicitly override it .

Build system

Xcode A new auxiliary editor is provided for building logs , Focus on parallelism to help identify build performance issues . This visualization displays events as a grid of colored blocks , Where the vertical axis represents the degree of parallelism , The horizontal axis represents time .

Xcode 14 Can now be linked to their Swift Target dependencies compile targets in parallel .

Swift Drivers are choreographers Swift Components invoked by the front end , Now integrated into Xcode In the construction system of , Allow fine-grained dependencies on other build system tasks and explicit scheduling .

stay Build Phases In the pane , You can now batch edit files in the multi select table view . When editing the platform filter column of the table , The system applies the changes to all files in the selection .

only Swift The framework and dynamic library target of can use EAGER_LINKING Build setup select a new build system optimization . When this feature is enabled ,Xcode Will be in Swift Issue additional artifacts during compilation , This allows Xcode Unblock downstream targets earlier , This increases parallelism in the build .

debugging

The memory graph debugger now displays all incoming and outgoing references in the memory graph . You can adjust the set of visible nodes in the new pop-up box .

LLDB Now in Xcode And display progress updates on the command line for long-running operations .

Now you can use xcrun crashlog  call LLDB Crash log script for . 

When debugging an application , The thread performance checker displays runtime performance issues in the issue navigator and source code editor . Select the thread performance checker check box in the running scenario of the application target to enable this feature .

Xcode Now in Report navigator A new startup log is displayed in . This log indicates Xcode install 、 Actions taken for startup and commissioning .

file

Xcode Medium Swift-DocC Now support is Objective-C and C API Build documentation .

Xcode 14 Generated Swift-DocC The documentation site includes a new navigation sidebar , For browsing and filtering documents .

By default ,Xcode 14 Generated Swift-DocC The document is now compatible with most managed services , Include GitHub Pages.

Instruments

Now? , When the time filter is active , Aggregate functions that run over time intervals can calculate their results more accurately , Based only on the total interval portion that intersects the current time filter .

The details filter now allows you to apply the filter to specific columns when viewing the list view . You can add these types of filters by using the context menu on the displayed value or by entering a tag and then selecting the tag type .

Instruments Now include a new Swift Concurrency Templates , For tracking Swift The use and behavior of concurrency primitives . This template contains :

  • A new kind of Swift Tasks Tools , It can display the task status changing with time 、 Summarize task status 、 Provide detailed task descriptions 、 Explain the structured concurrency relationship and build the call tree for the task to create the call stack .

  • A new kind of Swift Actors Tools , Used to track task behavior across participants , Show the task queue for each participant , And help diagnose the problem of participant isolation code and contention .

These tools need Swift Tools in the concurrent runtime , The runtime starts with macOS 13、iOS 16、tvOS 16 and watchOS 9 Or later .

Instruments There's a new one Hang Tracing Tools , It can show when the main thread of the application cannot process incoming events for a long time , This may lead to UI Hang up . Besides ,Time Profiler and CPU Profiler The instrument also shows potential hangs .

Instruments A new Core ML Templates . This template includes new Core ML And nerve engine instruments and GPU And time analyzer tools . Use this template to help analyze Core ML And understand how your model works on your device . The combination comes from Core ML、 Neural engines and GPU The information of the instrument can help track the operation performed on the acceleration hardware . Every event 、 Both model and sub model have aggregated time series data .

Instruments There's a new one Runloop Tools , It shows runloop Use of and individual iterations , And visually distinguish all in the process runloop Of runloop Sleep and busy intervals .

Interface Builder

UISplitViewController Now supports the use of Mac Catalyst Built Mac Sidebar in application . To enable the sidebar , Please set the main style in the property inspector of the split view controller .

Interface Builder Now you can update asynchronously scene.

WKWebView A new check box appears on the , To enable standard find and replace UI.

You can now select symbols through the control's image inspector , Use NSButton and NSImageView edit SF Default configuration of symbols ( Including Fonts 、 Scale and thickness ).

Support iOS Of UIPasteControl To allow you to paste content by clicking without pasting notifications or alerts . This control can be used for any UIPasteConfigurationSupporting The object of ( for example ,UIResponder) To receive the pasted content .

Access and search through the symbol library tab SF Symbol . Open the library (Xcode > View > Show Library) And click Symbols tab . You can drag symbols into the source code editor .

localization

Now you can export local Swift Localization of packages .Xcode For all projects and... Contained in the project or workspace Swift Package generates a single localized Directory . You can also use  xcodebuild -importLocalizations and xcodebuild -exportLocalizations  To export or import Swift package .

Organizer

Xcode Organizer The suspend report in provides diagnostic reports about application hangs , To help improve responsiveness . Generate reports for individual application versions and sort by severity . They include sample logs of hangs that occur on the main thread that can be used for debugging , And the affected equipment and iOS Version Statistics .

preview

Xcode Previews You can now run on physical devices , Without having to include an application , This makes it easy to preview frames and... On the device Swift package .Xcode The appropriate signing application will be automatically prepared for your default signing identity to host the preview .

Xcode Previews You can now use the scheme's runnable file when deciding which application to use to host the preview . for example , In a full version of an application and beta Both versions share a framework in the project ,Xcode Previews The application to be launched will be automatically selected for preview according to the selection in the scheme .

Xcode Now show each preview on its own dedicated page , This includes allowing you to change common settings ( Such as color scheme 、 Orientation or dynamic font size ) New controls without writing any code .

Xcode Preview is now interactive by default .

restructure

Refactoring operations have been added to add explicit Codable Realization .

Sign and distribute

Develop signed DriverKit The driver now supports automatic signing . Distribution still requires Apple Approval , And in Apple Developer Manually configure additional features on the web site .

Simulator

The emulator now supports on with Apple silicon or T2 The processor Mac On the computer macOS 13 Middle runtime ,iOS 16 Remote notification in . The simulator supports Apple Push Notification Service Sandbox Environmental Science . Your server can connect to APNS The sandbox (api.sandbox.push.apple.com) Send remote notifications to applications running in the simulator . Each simulator will generate the simulator and run it Mac Registration token unique to the hardware combination .

The length of the device registration token is variable . The token in the simulator may be larger than the current physical device token . Do not hard code any specific length or format for these tokens .

simctl Control of simulation position is now supported , Including operation scenarios and interpolation between waypoint lists .

In addition to the existing runtime bundle format , The simulator now also supports runtime disk images . The disk image is added to a system management storage location protected by system integrity protection , And installed at the installation point of system management .

Source editor

Now? , When scrolling through documents ,Xcode Pin the elements of the code structure to the top of the editor .

Swift Errors in the file now provide a fix for adding missing imports .

Added right Swift Syntax highlighting and editing support for regular expressions . You can now use Editor > Refactoring > Convert to Regex Builder Converts a regular expression literal to its equivalent regular expression builder . When you move the insertion point within the regular expression text , The closed substructure of the regular expression highlights .(82540073)

Xcode A file template is now provided , For your iOS Applications choose the touch alternative . You can use the touch alternative method in the with Apple Chip Mac Interact with your application on - for example , Hold down Option Key to use the touchpad as a virtual touch screen . To enable the , Please select File > New File > iOS > Resource > Touch Alternatives, Then configure the newly added com.apple.uikit.inputalternatives.plist File to choose a touch alternative for your app .(84271952)

Swift The code completion in now provides a member initializer fragment .

Swift The code completion in now provides if case Fragment of statement .

StoreKit

Xcode Now it is possible to App Store Connect The products purchased in the app in are synchronized to StoreKit In profile , In order to be in Xcode Test faster in settings StoreKit. There is also an updated transaction manager , With filter and transaction checker .

Swift Packages

Conflicting modules with the same name can now be disambiguated by aliases . The package list introduces a new parameter “moduleAliases”; It allows users to define unique names for conflicting modules , And build them with a new name , Without changing any source code .

Now you can Xcode Use in Swift Package Command plug-ins , The method is to use File > Packages Menu or Xcode Context menu in file navigator . Any command plug-ins provided by package dependencies are available . You can choose which targets of the package the command applies to , And you can pass custom parameters to plug-ins . The report navigator displays the results of running the command . If the command indicates that it needs to write to the source file of the package ,Xcode Will request permission and let you check the plug-in's source code before running the plug-in .

Xcode For now Swift Package The plug-in provides XcodeProjectPlugin API, The API Expanded Swift Package Manager Of PackagePlugin API. Use this API, Plug ins can be obtained Xcode A simplified description of the project structure . This gives way to Xcode The adapter plug-in running in can be in Xcode Use this API. You can still go through Xcode Medium Swift Package usage has not been adapted to support Xcode The package of the project .

test

XCTAssertThrows() And related macros are now capturing division NSException Throw an exception other than ( Include C++ abnormal ) Provides richer diagnostic information .

XCTest Include a new Swift-only Expected type XCTKeyPathExpectation, It can be used instead of XCTKVOExpectation To observe yes Swift Change of key path .

Test targets that have parallelization enabled in the activity plan or test plan are now executed in parallel with each other . before , Each target is executed serially , The test classes in each target are executed in parallel . Now? ,Xcode Execute the target and its classes in parallel , I prefer to fan out across targets first . For a suite with a large number of targets , This can lead to significant acceleration ( Results vary depending on hardware and suite composition ). Test targets that do not enable parallelization continue to execute independently of other targets .

Once the test is completed and errors or faults are encountered ,XCTest System diagnostics will be captured . This behavior can be achieved through a test plan or xcodebuild Command line interface for control .


copyright notice
author[Small set],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/175/202206240813339777.html

Random recommended