xcode 9 新特性

原文链接

Xcode 9的新功能

Xcode是用于为Apple TV,Apple Watch,iPad,iPhone和Mac创建应用程序的完整开发人员工具集。Xcode开发环境采用tvOS SDK,watchOS SDK,iOS SDK和macOS SDK的形式捆绑Instruments分析工具,Simulator和OS框架。

Xcode 9的亮点

Xcode 9包括整体质量改进以及广泛的新功能。

全新编辑。快速,基于结构的编辑器,可让您智能地突出显示和浏览您的代码。包括伟大的Markdown支持。

重构。重构内置于编辑体验之中,并可跨Swift,Objective-C,Interface Builder和许多其他文件类型。

超快速搜索“查找”导航器会立即返回结果。

调试。通过网络无线调试iOS和tvOS设备,Metal的新调试器以及Xcode中的更多功能。

源代码管理。所有新的源代码管理导航器和对GitHub帐户的集成支持能够快速浏览存储库并将其推送到云端。

Xcode服务器内置。运行连续集成机器人可以在任何具有Xcode 9的Mac上运行,无需安装macOS Server。

新游乐场模板新的iOS模板,旨在在iPad上的Xcode和Swift Playground中运行良好。

新建系统。Xcode新的构建系统的选择性预览提高了可靠性和性能。

一般

更新了使用plist文件定义文本宏的方法。

为项目中的用户,项目或特定用户定义文本宏。

自定义新的文件头。有关更多信息,请参阅Xcode帮助中的自定义文件标题

更新了索引引擎,以便在编译时对索引文件进行索引。

将“设备”窗口拆分为设备和模拟器的单独窗格。

资产目录

命名颜色支持。

添加了广泛的应用程序图标。

在App Icon集中增加了一个较大的iOS营销图标。

添加了保留图像矢量数据以选择动态类型缩放的选项。

增加了对HEIF图像的支持。

建筑与连接

新的Xcode 9 - Swift静态库支持。

增加了对包含Swift代码的静态库目标的支持。

Xcode 9中的新功能 - 在Swift中编写的新构建系统的预览。目前,该系统是可选的,但它将成为未来版本的Xcode中的默认设置

添加了一个以Swift编写的新构建系统的预览。

提供更高的可靠性

捕获许多项目配置问题。

提高整体构建系统性能。

注意,构建系统性能不包括构建系统使用的编译器,链接器和其他工具。

要选择项目或工作区的新构建系统,请选择“文件”>“项目设置”或“文件”>“工作区设置”,然后选择“构建系统”类型的“新建构建系统(预览)”。有关与现有项目兼容的注意事项,请参阅Xcode发行说明

功能

iOS热点和多路径TCP的新配置。

New network configurations, including content filtering, proxying DNS queries, and proxying TCP and UDP connections.

New background mode for watchOS for use with audio recording and turn-by-turn directions.

New mode for tvOS background fetch.

Core ML

New in Xcode 9 – Core ML editor.

Generate strongly typed interfaces for the model.

Model compilation for on-device usage.

Debugging

New in Xcode 9 – Network debugging for iOS and tvOS devices.

Debug iOS and tvOS devices over WiFi or wired networks.

Connect through Bonjour or enter an IP address.

To enable network debugging, seePair a wireless devicein Xcode Help.

New in Xcode 9 – GPU frame capture and GPU overrides.

View command buffers, attachments, resources, and call stacks.

Modify shaders and save changes to your app.

Move through the timeline for the sequence.

Inspect and modify values for individual pixels in attachments including color values, alpha, depth, and more.

Experiment with the rendering state without modifying code by minimizing texture bandwidth, minimizing number of rendered pixels, disabling the blending stage, showing only the wireframe, and scaling the amount of tessellation.

New in Xcode 9 – Undefined Behavior Sanitizer.

Find sources of program crashes, unexpected behaviors, and incompatibilities with future versions of Xcode.

Detect several types of undefined behaviors in C languages such as integer overflow, invalid casts, and alignment violations.

Enable theUndefined Behavior Sanitizerin the Diagnostics pane of the scheme editor.

New in Xcode 9 – Main Thread Checker.

Detect AppKit, UIKit, and WebKit method calls that are not made on the main thread.

Automatically enabled during debugging, and can be disabled in the Diagnostic tab of the scheme editor. Use theMain Thread Checkerwith Swift and C languages.

Main Thread Checkerworks with Swift and C languages.

Enhanced the Breakpoint navigator with deep filtering.

Visual indicators for modified breakpoints.

Extended the view debugger to show view controllers, and to work with SceneKit and SpriteKit views.

Enhanced iOS energy gauge.

Documentation

New unified browser that integrates reference, sample code, and articles.

Improved documentation search.

New jump bar for navigating between pages.

Integrated sample code downloading.

Instruments

New split view for pinning graphs in the graphing area of a trace document.

Moved the strategy picker into a new toolbar at the top of the trace document and added a new All strategy.

Enhanced Metal debugging instrument.

Metal system trace VR support for viewing events such as compositor activity, pose queries, and more.

Interface Builder

Named colors from the asset catalog.

New margin and baseline view constraints.

Auto Layout safe-area guides.

Full-screen watchOS apps.

Metal 2 Support

New in Xcode 9 - Capture API.

Define explicit capture boundaries in your code.

Use the newMTLCaptureManagerclass and the newMTLCaptureScopeprotocol to set, manage, and trigger capture boundaries programatically.

Use the extended Xcode GPU Capture UI to start and stop captures manually. You can also use Xcode to capture API boundaries defined in your app.

New in Xcode 9 - GPU counters.

Analyze detailed profiling metrics about a specific GPU capture. In iOS and tvOS, GPU counters are shown as a timeline of command encoders; in macOS, GPU counters are shown as a timeline of draw or dispatch calls.

Examine runtime performance of render or compute pipeline stages, such as the vertex shader, fragment shader, compute kernel, and more.

Compare the amount of GPU time spent in each pipeline stage to find your performance bottlenecks.

New in Xcode 9 - GPU remarks.

Find optimization opportunities in your Metal shading language code.

Debug device-specific runtime issues in the shader editor.

Follow direct resolutions and instructions to improve your code.

New in Xcode 9 - Smart filtering.

Find specific debug information by typing into the debug navigator. Xcode dynamically displays suggestions as you type and highlight matching text, such as resources, pixel formats, function names, object labels, and more.

Filter search results by selecting options from a predefined menu of Metal objects.

Use multiple filters with many matching conditions.

New in Xcode 9 - Virtual Reality (VR) support.

View VR submissions and left-eye/right-eye submitted surfaces.

Texture inspection for inspecting values of individual pixels in render targets, such as color, alpha, depth, and more.

Inspection of output vertex attributes in the buffer editor.

Data tips support for Metal objects such as textures, buffers and samplers.

Refactoring

Rename a symbol in a single file or in a project across Swift, C, Objective-C, C++ files, and Interface Builder files.

View all the possible changes in one editor pane.

Convert method signatures between Swift and Objective-C formats.

Update properties, getters, setters, and synthesized iVars as needed.

Apply a fix-it everywhere with one button.

Automatically fill in missing cases in switch statements, and mandatory methods for protocol conformance with one click.

Extract method functionality for all supported languages, along with other language-specific local refactoring.

Simulator

New in Xcode 9 - Multiple concurrent simulators.

Run multiple simulators at the same time.

Run more tests in parallel.

Test synching and other multidevice workflows.

New bezel for iOS and watchOS simulators includes the hardware controls. Use the bezel to move or resize the simulated device.

Share information with Simulator from Maps, Photos, and Safari.

Hold down the Option key when closing a simulated device or quitting Simulator to keep simulators running after closing the window or quitting Simulator for better integration with thesimctlcommand of thexcruncommand line tool.

Record videos of simulators.

Open the new Simulator documentation by choosing Help > Simulator Help.

Source Control

New source control navigator for viewing branches, tags, and remote repositories for the current workspace.

New source control inspector shows details for the selected navigator item.

New editor for branch history including a jump bar for easy navigation.

New side-by-side editor for file diffs.

Easier and faster access to common tasks.

GitHub account integration for easy browsing and one-click creation of a project and the associated GitHub repository.

Source Editing

New in Xcode 9 – New source editor.

Faster and more versatile Find and replace.

Fast scrolling for files of any size.

Direct manipulation of code structure such as tokens and blocks.

Redesigned integration for source control.

Redesigned presentation of error and warning messages.

Support for Markdown.

Swift

New in Xcode 9 – Swift 4.

One compiler for Swift 4 and Swift 3. You can compile Swift 4 and Swift 3 targets together in the same project.

Improved migration experience that supports migrating only select targets to Swift 4. See,Migrate to Swift 4 @objc inferencein Xcode Help.

Faster generic code and decreased code size.

Testing

New in Xcode 9 – Parallel device testing.

Added new APIs to XCTest.

Control and capture screenshots.

Group test activities.

Test attachments.

Cleanup test state in a teardown block.

Target multiple apps in one UI test.

Run tests using a specified language and region.

Xcode Server

New in Xcode 9 - Built in Xcode Server.

New Server & Bots pane in Preferences for configuring Xcode Server and for setting Bot permissions.

Added support for 2-factor authentication.

Updated functionality for bots.

Support automatic and manual provisioning workflows.

Pass additional arguments toxcodebuild.

Run tests in parallel on devices and Simulator.

Configure language and region for tests.

Send "all clear" emails notifications.

Compatibility

Xcode 9.0 requires a Mac running macOS Sierra 10.12.4 or later.

Installation

You obtain Xcode 9 from the Mac App Store. It is a free download that installs directly into the Applications folder. By default, Xcode downloads developer documentation in the background for offline reading; it also automatically downloads documentation updates. This behavior can be changed after installation using the Downloads preferences pane.

Developer Resources

The Apple Developer Program provides access to the App Store, Mac App Store, and Apple TV App Store, additional support and documentation, and signing resources for testing and deployment on Apple TV, Apple Watch, iPad, iPhone, and iPod touch devices. For more information, visit theApple Developer Program website.

VisitApple Developer Forumsfor discussions about any Apple developer software, including prerelease products.

For the latest security information, visitApple security updates.

About SDKs and Simulator

A software development kit (SDK) is a collection of frameworks (libraries, headers, and resources) that represent the API for a specific watchOS, iOS, or macOS version. Most of the functionality your app gets from an SDK is actually provided by the host operating system, which sets the correct base SDK and OS Deployment Target settings that are critical for app compatibility. Xcode automatically builds with the latest SDK and targets the latest OS.

If your app doesn’t require the latest OS features, you can configure it to run on a previous version of the platform operating system by selecting the OS Deployment Target option in the Xcode Project settings. If your project was created in an older version of Xcode, you can let Xcode update your project. For details on this feature, seeProject Modernization.

Important:Before submitting your app to the App Store, you must test on a device running your supported target OS version or versions.

Automatic Signing

Changes to the signing processes may impede your development if you're working on an older project that has not been updated to the current signing process.

The recommended approach for both enterprise and App Store developer accounts is to use automatic signing in Xcode to code sign apps during both development and distribution. See Xcode Help for documentation on automatic signing. If you have an older project that isn't configured to use automatic signing, readTechnical Q&A (QA1814) "Setting up Xcode for Automatic Provisioning"to learn how to reconfigure your Xcode project.

Consider automatic signing before using other techniques. If your projects do require manual signing, search for “manually sign” in Xcode Help to review current manual signing practices.

Project Modernization

When you open a project, Xcode evaluates it to see whether any settings should be updated. This feature makes it easy to ensure your projects conform to the latest SDKs and best practices.

Open the issue navigator to see whether anything in your project needs to be updated. You can also select the project in the project navigator, and then choose Editor > Validate Settings.

If the issue navigator lists modernization issues, click the issue to see a dialog that explains the updates that should be made and that lets you perform any or all of them.

After you click Perform Changes, regardless of whether you choose to make all the changes, Xcode does not show the warning again. To rerun the check, select your project in the project navigator and choose Editor > Validate Settings.

See Also

To learn more about using Xcode, choose Help > Xcode Help.

下一个

版权所有©2017 Apple Inc.保留所有权利。使用条款|隐私政策|更新日期:2017-09-19

反馈

*

*

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,319评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,801评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,567评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,156评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,019评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,090评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,500评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,192评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,474评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,566评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,338评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,212评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,572评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,890评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,169评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,478评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,661评论 2 335

推荐阅读更多精彩内容