xcode 12新功能
Xcode 12 was officially released on September 16, 2020. Now that we know the big changes are done and beta is over, let’s look at what has changed.
Xcode 12于2020年9月16日正式发布。现在我们知道已经完成了大的更改并且beta已结束,让我们看看发生了什么变化。
Starting with a new project, you will see a new option called Multiplatform.
从一个新项目开始,您将看到一个名为Multiplatform的新选项。
This option allows you to deploy your app directly to macOS and iOS all from the same shared codebase. Also, you do need macOS Big Sur to develop Multiplatform apps.
此选项使您可以从同一共享代码库将应用程序直接直接部署到macOS和iOS。 此外,您确实需要macOS Big Sur来开发Multiplatform应用程序。
(Storyboard Interface)
Once we are inside a new project, starting on the left side Project Navigator. Some icons have changed here but the functionality is the same. But, if you’re like me and can barely see the files, there is finally a solution. If you go to Xcode -> Preferences -> General you will see an option called Navigator Size giving you four options to fit your needs. While you’re here you can go to the Navigation tab and customize shortcuts and new tabs when viewing files.
一旦进入新项目,请从左侧的项目导航器开始。 这里的某些图标已更改,但功能相同。 但是,如果您像我一样,几乎看不到文件,那么总有一个解决方案。 如果转到Xcode->首选项->常规,则会看到一个名为Navigator Size的选项,为您提供四个选项来满足您的需求。 在这里,您可以转到“导航”选项卡,并在查看文件时自定义快捷方式和新选项卡。
If you haven’t jumped ship in favor of SwiftUI and find yourself still using storyboards, Xcode 12 now gives you a minimap you can click and drag for easy navigation. This becomes especially useful when handling multiple ViewControllers in the same storyboard. If you don’t want to see the minimap, maybe you only have one ViewController, you can remove it from Editor -> minimap. Lastly for storyboards are some new icons you will see in the Inspector pane on the right. New look, same functionality. While we are here, with any new update there is a risk of bugs. And one I’ve noticed is the details from Attributes Inspector are sometimes missing when selecting a view, if this happens you can simply press CMD + T to open a new tab. Close the original tab and you should be good to go.
如果您还没有支持SwiftUI并发现自己仍在使用情节提要,那么Xcode 12现在会为您提供一个迷你地图,您可以单击并拖动它来轻松导航。 当在同一情节提要中处理多个ViewController时,这尤其有用。 如果您不想看到小地图,也许只有一个ViewController,则可以从编辑器->小地图中将其删除。 最后,对于情节提要,您会在右侧的“检查器”窗格中看到一些新图标。 外观新颖,功能相同。 当我们在这里时,任何新的更新都存在存在错误的风险。 我注意到的是,选择视图时,有时会缺少Attributes Inspector的详细信息,如果发生这种情况,您只需按CMD + T即可打开一个新选项卡。 关闭原始标签,您应该一切顺利。
(SwiftUI Interface)
SwiftUI Previewer Options SwiftUI预览器选项
Swift UI has a number of great changes with the recent release of SwiftUI 2.0. But this is about Xcode so on we go. If you look at the code Preview at the right, the options have been conveniently placed at the top. On the left you can run the preview or build to a device. On the right you have a menu that lets you customize the preview for size classes, orientation, Light/Dark mode, and even the size of the Struct you are previewing. To make this even better we have the Duplicate Preview button on the far right which will automatically add another preview which you can customize with different settings to see multiple possibilities at once.
SwiftUI在最近发布的SwiftUI 2.0中进行了许多重大更改。 但这是关于Xcode的,所以我们继续。 如果您看一下右侧的代码“预览”,则可以方便地将这些选项放在顶部。 在左侧,您可以运行预览或构建到设备上。 右侧有一个菜单,可让您自定义尺寸类别,方向,明/暗模式甚至预览的Struct尺寸的预览。 为了使此效果更好,我们在最右边具有“复制预览”按钮,该按钮将自动添加另一个预览,您可以使用不同的设置对其进行自定义以一次查看多种可能性。
If you select a view inside the Struct, there is an improved Inspector menu you can view on the right of the screen. This is a visual representation of a few options you have for changing the selected view, and when you select one, you will see the code automatically be added. There is also an improved list of Modifiers at the bottom. If you happen to keep the right Inspector tab closed for the sake of screen space, you can access this menu by pressing Control + Option and clicking on the element you would like to customize.
如果在“结构”内选择一个视图,则可以在屏幕右侧查看一个改进的“检查器”菜单。 这是更改所选视图的几个选项的直观表示,选择一个视图时,您将看到代码自动添加。 底部还有一个改进的修饰符列表。 如果出于屏幕空间的原因恰好保持右侧的“检查器”选项卡关闭,则可以通过按Control + Option并单击要自定义的元素来访问此菜单。
Of course Xcode offers many more unique tools for making developing easier and debugging more robust, but these are a few of the stand out changes from Xcode 11 -> 12.
当然,Xcode提供了许多独特的工具,使开发变得更容易并且调试更强大,但是这些是Xcode 11-> 12的一些突出变化。
And remember; be like Xcode, and slowly improve yourself.
记住像Xcode一样,慢慢提高自己。
翻译自: https://medium.com/@coder.nate88/whats-new-in-xcode-12-6bc790caef40
xcode 12新功能