xcode入门

Xcode is at the center of all development on Apple’s platforms, and with Xcode 12, it has a fresh new look to match macOS Big Sur. Xcode 12 for macOS Universal Apps beta is a distribution of Xcode 12 beta for creating Universal Mac apps that run on both Apple silicon and Intel-based Mac computers.

Xcode是Apple平台上所有开发的核心,并且通过Xcode 12,它具有与macOS Big Sur匹配的崭新外观。 适用于macOS的Xcode 12 Universal Apps beta是Xcode 12 beta的发行版,用于创建可在Apple芯片和基于Intel的Mac计算机上运行的Universal Mac应用程序。

Here is some introduction about new updates in xcode, it is Xcode 12 Beta release. Update your apps to use new features and test your apps against changes in API. New document tabs make opening multiple files fast and lightweight to support interface files, and logs and project files each open in their own tab. Navigator fonts now match the system size, or can be set to small, medium, or large. And Xcode 12 builds macOS Universal apps by default to support new Macs with Apple silicon.

这是有关xcode中新更新的一些介绍,它是Xcode 12 Beta版本。 更新您的应用程序以使用新功能,并针对API的更改测试您的应用程序。 新的文档选项卡使打开多个文件既快速又轻便,以支持界面文件,并且日志和项目文件均在各自的选项卡中打开。 导航器字体现在与系统大小匹配,或者可以设置为小号,中号或大号。 Xcode 12默认情况下会构建macOS Universal应用程序,以支持带有Apple芯片的新Mac。

Image for post
developer.apple.com developer.apple.com

Xcode 12 for macOS Universal Apps beta includes SDKs for iOS 14, iPadOS 14, and macOS 11. The Xcode 12 for macOS Universal Apps beta release supports on-device debugging for iOS 9 and later. Xcode 12 for macOS Universal Apps beta requires a Mac running macOS 10.15.4 or later.

适用于macOS Universal Apps beta的Xcode 12包括适用于iOS 14,iPadOS 14和macOS 11的SDK。适用于macOS Universal Apps beta的Xcode 12支持针对iOS 9及更高版本的设备上调试。 Mac OS X的Xcode 12 Universal Apps beta需要运行macOS 10.15.4或更高版本的Mac。

Xcode’s run destination menu now shows an “Any Mac” destination for Mac schemes. This is a new build destination that builds each target in the scheme for all of their supported architectures, regardless of the native architecture of the local Mac.

Xcode的运行目标菜单现在显示Mac方案的“ Any Mac”目标。 这是一个新的构建目标,可以为方案中的所有受支持体系结构构建每个目标,而与本地Mac的本机体系结构无关。

New Features

新功能

Documents can now be opened in their own tab, making it easy to quickly switch between files while maintaining the rest of Xcode’s configuration. Option-click or double-click to open a document in a tab.

现在可以在它们自己的选项卡中打开文档,从而可以轻松地在文件之间快速切换,同时保持Xcode的其余配置。 按住Option键单击或双击以在选项卡中打开文档。

Xcode adds support for previewing widgets, App Clips, and content in Swift packages. For more seamless live previewing on device, Xcode installs the new Xcode Previews app for iOS 14 and iPadOS 14.

Xcode增加了对预览小部件,应用程序剪辑和Swift包中的内容的支持。 为了在设备上进行更无缝的实时预览,Xcode安装了适用于iOS 14和iPadOS 14的新Xcode Previews应用。

The new LibraryContentProvider protocol gives you the ability to show your views and modifiers in Xcode’s library.

新的LibraryContentProvider协议使您能够在Xcode的库中显示视图和修饰符。

Code completions have a new, focused, user interface, making it easier to find a completion. Completions are also more accurate and up to 12 times faster in Xcode 12.

代码补全具有一个新的,集中的用户界面,使查找补全更加容易。 Xcode 12中的完成也更准确,速度*高可提高12倍。

资产目录 (Asset Catalogs)

It adds support for Scalable Vector Graphic (SVG) image assets. These preserve their vector representation with deployment targets of macOS 10.15 or later, iOS 13 or later, and iPadOS 13 or later.

它增加了对可缩放矢量图形(SVG)图像资产的支持。 它们使用macOS 10.15或更高版本,iOS 13或更高版本以及iPadOS 13或更高版本的部署目标保留其矢量表示。

The required pixel size is now shown for complication placeholder images.

现在显示了复杂占位符图像所需的像素大小。

The “New Asset” menu has been changed to organize asset types by platform.

“新资产”菜单已更改为按平台组织资产类型。

调试 (Debugging)

When a process crashes under the debugger, Xcode prints the crash messages in the Console. These messages are similar to the ones displayed in CrashReporter.

当进程在调试器下崩溃时,Xcode在控制台中打印崩溃消息。 这些消息类似于CrashReporter中显示的消息。

Xcode debugger annotations will highlight source code with greater opacity to improve visibility in several Xcode themes.

Xcode调试器批注将以更高的不透明度突出显示源代码,以提高在多个Xcode主题中的可见性。

If you have disabled breakpoints in the Breakpoint Navigator, you can use the contextual menu to delete all the disabled breakpoints.

如果已在“断点导航器”中禁用了断点,则可以使用上下文菜单删除所有禁用的断点。

When paused in the debugger, stepping out of a block will unwind and land in a frame with debug symbol.

在调试器中暂停时,跳出块会展开并降落在带有调试符号的帧中。

设备 (Devices)

The “Add Device” sheet in the Devices and Simulators window is now resizable.

现在,“设备和模拟器”窗口中的“添加设备”工作表可调整大小。

The Devices and Simulators window permits selecting multiple devices in the navigator, so they can be unpaired together.

“设备和模拟器”窗口允许在导航器中选择多个设备,因此可以将它们取消配对。

界面生成器 (Interface Builder)

It Added support for the new safeAreaLayoutGuide on NSView introduced in macOS 11.

它增加了对macOS 11中引入的NSView上新的safeAreaLayoutGuide的支持。

Introduced a new minimap for the Interface Builder canvas. You can show and hide the minimap with Editor > Canvas > Minimap. Drag the minimap to any corner of the canvas.

为Interface Builder画布引入了一个新的小地图。 您可以使用“编辑器”>“画布”>“小地图”显示和隐藏小地图。 将小地图拖到画布的任何角落。

Find and Replace now includes matches in attributed string literals.

查找和替换现在在属性字符串文字中包含匹配项。

Interface Builder now has a Current Date option for NSDatePicker.

Interface Builder现在为NSDatePicker提供了“当前日期”选项。

Standard spacing constraints are now created by default when items are positioned a standard distance from each other.

现在,默认情况下,当项目彼此之间的距离为标准距离时,会创建标准间距约束。

Added support for SF Symbols in macOS 11.

在macOS 11中添加了对SF符号的支持。

Added support for UIButton.ButtonType.close .

添加了对UIButton.ButtonType.close的支持。

Added support for the new toolbarStyle in macOS 11.

在macOS 11中添加了对新工具toolbarStyle支持。

Added support for the new subtitle property in macOS 11.

在macOS 11中添加了对新subtitle属性的支持。

Added support for the new NSSearchToolbarItem in macOS 11.

在macOS 11中添加了对新NSSearchToolbarItem支持。

Added support for selecting text styles in macOS 11.

添加了对在macOS 11中选择文本样式的支持。

Added support for the new NSTableViewStyle with Automatic, Full Width, Inset, and Source List options.

添加了对带有自动,全宽,插入和源列表选项的新NSTableViewStyle支持。

游乐场 (Playgrounds)

In Xcode Playgrounds now you can import and use Swift packages and frameworks. Select the Build Active Scheme checkbox in the playground’s File inspector and ensure that the active scheme builds the package or framework target.

现在,您可以在Xcode Playgrounds中导入和使用Swift包和框架。 选中游乐场的文件检查器中的“构建活动方案”复选框,并确保活动方案可构建包或框架目标。

Xcode’s Report Navigator now includes Playground build logs.

Xcode的Report Navigator现在包括Playground构建日志。

Xcode Playgrounds now build the active scheme’s targets and make them importable when Build Active Scheme is enabled in the File inspector.

Xcode Playgrounds现在可以构建活动方案的目标,并在文件检查器中启用“构建活动方案”后将其导入。

预告片 (Previews)

Xcode now considers edited files and open previews when selecting which app renders previews

Xcode现在可以在选择哪个应用程序呈现预览时考虑编辑过的文件并打开预览

Each preview now has buttons to start Live Preview, Preview on Device, Inspect Preview, and Duplicate Preview.

现在,每个预览都有用于启动实时预览,在设备上预览,检查预览和重复预览的按钮。

You can click the Inspect Preview button to see modifier recommendations for the selected view and search for the modifier you want to apply.

您可以单击“检查预览”按钮以查看选定视图的修改器建议,并搜索要应用的修改器。

Xcode supports previewing widgets. For an example of how to configure a widget preview, see WidgetPreviewContext.

Xcode支持预览小部件。 有关如何配置窗口小部件预览的示例,请参见WidgetPreviewContext 。

The Attributes inspector now offers quick actions for editing the name, device, layout, preferred color scheme, and accessibility text size of a selected preview.

现在,“属性”检查器提供了快速操作,可用于编辑所选预览的名称,设备,布局,首选配色方案和可访问性文本大小。

Xcode Previews now supports previewing views in frameworks on-device if the framework is linked by an app in the selected scheme.

如果框架通过选定方案中的应用程序链接,则Xcode Previews现在支持在设备上预览框架中的视图。

Xcode now supports previews for App Clips.

Xcode现在支持应用剪辑的预览。

Xcode now connects with the new Xcode Previews app for iOS 14 and iPadOS 14 for greatly improved on-device previews. The Xcode Previews app seamlessly displays changes from Xcode Previews on devices.

Xcode现在可以与适用于iOS 14和iPadOS 14的新Xcode预览应用程序连接,以大大改善设备上的预览。 Xcode Previews应用程序无缝显示设备上Xcode Previews中的更改。

The bottom bar of the canvas now contains a button for quickly inspecting the selected view.

现在,画布的底部栏包含一个用于快速检查所选视图的按钮。

仿真器 (Simulator)

Simulator can display a simulated device in full-screen mode, or tile its window alongside Xcode.

Simulator可以全屏模式显示模拟的设备,也可以将其窗口平铺在Xcode旁边。

Simulator now supports 64-bit and 32-bit processes for watchOS 7. To verify watchOS projects are 64-bit clean in Simulator, make sure ARCHS is set to its default value.

Simulator现在支持watchOS 7的64位和32位进程。要验证watchOS项目在Simulator中是否为64位纯净,请确保将ARCHS设置为其默认值。

Window > Stay on Top keeps device windows in front of other application windows.

窗口>停留在顶部可使设备窗口位于其他应用程序窗口的前面。

Simulator defaults to the internal microphone unless you explicitly choose a different audio source. This avoids triggering phone call mode on Bluetooth headsets which degrades audio quality while listening to music.

模拟器默认为内置麦克风,除非您明确选择其他音频源。 这样可以避免在蓝牙耳机上触发电话呼叫模式,而这会在听音乐时降低音频质量。

Simulator supports simulating Nearby Interaction for devices that support the feature. Dragging the device window around on the screen will update the simulated distance between the two devices. The farther apart the windows are on screen the greater the reported distance.

模拟器支持为支持该功能的设备模拟“邻近交互”。 在屏幕上四处拖动设备窗口将更新两个设备之间的模拟距离。 窗口在屏幕上的距离越远,报告的距离就越大。

Swift (Swift)

Swift indentation has been overhauled, greatly improving the indentation of chained methods calls, especially those that involve nested or trailing closures.

快速缩进已得到全面改进,大大改善了链式方法调用的缩进,特别是那些涉及嵌套或尾随闭包的调用。

A property with an attached property wrapper can now rely on type inference to infer the wrapped value type when using default initialization without empty parentheses on the wrapper attribute. For example:

使用默认初始化时,具有附加属性包装器的属性现在可以依靠类型推断来推断包装的值类型,而在包装器属性上没有空括号。 例如:

Image for post
developer.apple.com developer.apple.com

The wrapped property UseWrapper.value uses default initialization of IntWrapper, and relies on type inference to deduce the type-wrapped value type to be Int.

包装的属性UseWrapper.value使用IntWrapper的默认初始化,并依靠类型推断将类型包装的值类型推论为Int。

Swift now allows the implicit use of self in @escaping closures when reference cycles are unlikely to occur.

现在,当不太可能发生引用循环时,Swift允许在@escaping闭包中隐式使用self。

First, implicit use of self in @escaping closures is now allowed if the user has explicitly captured self in the closure’s capture list, so the following code is now valid:

首先,如果用户已经在闭包的捕获列表中显式捕获了self,则现在允许在@escaping闭包中隐式使用self,因此以下代码现在有效:

Image for post
developer.apple.com developer.apple.com

Second, implicit self is available in @escaping closures when self is a value type, making the following code valid:

其次,当self是值类型时,隐式self在@escaping闭包中可用,使以下代码有效:

Image for post
developer.apple.com developer.apple.com

Notes: Here I try to give description about updates in xcode. It have amazing new features thats helps developers to design apps in easy way. Also It improves the speed for development.

注意:在这里,我尝试提供有关xcode更新的描述。 它具有令人惊叹的新功能,可帮助开发人员轻松设计应用程序。 还可以提高开发速度。

Let me know your thoughts in comment box below!!!