深度式睡眠潜入虚拟世界

介绍: (Introduction:)

SwiftUI is the most exciting news since Apple has announced Swift in 2014. It’s an enormous step towards Apple’s goal of getting everyone coding, simplifying the basics so we can spend more time on a custom features that delights our users.

自从苹果公司在2014年发布Swift以来,SwiftUI是最令人振奋的消息。这是朝着苹果的目标迈出的一大步,该目标是让所有人都编码,简化基础,以便我们可以花更多时间在使用户满意的自定义功能上。

SwiftUI framework and design tools work together to enable a new way to build a user interface. Before Xcode 4, IB and Xcode were separate apps and seam can be observed when we edit or delete any IBAction or IBOutlet from our code and run the build. What happens next is a nightmare for developers. Yeah, the right app gets crashed and the reason behind this is that IB doesn’t see changes to the code.

SwiftUI框架和设计工具一起工作以启用一种新的方式来构建用户界面。 在Xcode 4之前,IB和Xcode是单独的应用程序,当我们从代码中编辑或删除任何IBAction或IBOutlet并运行构建时,可以观察到接缝。 接下来发生的事情是开发人员的噩梦。 是的,正确的应用程序崩溃了,其原因是IB看不到代码更改。

But now with SwiftUI our code will always in our sync with design and preview canvas. SwiftUI lets us ignore IB and storyboard. If we are wondering whether we can use SwiftUI with xib and storyboard together then the answer is YES. SwiftUI doesn’t replace UIKit. We can use both in the same app just like Swift and objective-c can be used in the same project.

但是现在使用SwiftUI,我们的代码将始终与设计和预览画布保持同步。 SwiftUI让我们忽略IB和情节提要。 如果我们想知道是否可以将SwiftUI与xib和Storyboard一起使用,那么答案是肯定的。 SwiftUI不会取代UIKit。 我们可以在同一个应用程序中使用两者,就像Swift和Objective-c可以在同一项目中使用一样。

SwiftUI compiler build and run continuously, so we can preview a SwiftUI view side-by-side with it’s code. A change to one side will update the other side, so they are always in sync.

SwiftUI编译器会不断构建和运行,因此我们可以与它的代码并排预览SwiftUI视图。 更改一侧将更新另一侧,因此它们始终保持同步。

SwiftUI works for the majority of iOS devices. If we have designed our component for any specific device say iPhone then the same component can be used on other platforms with minimal code changes and we can reuse a lot of the same components. For e.g. we want to reuse our picker-view designed for iPhone on iPad or mac then this could be easily done by doing some changes in code like iPhone picker-view is like a list whereas for iPad it is pop-up and for mac, it is keyboard shortcut.

SwiftUI适用于大多数iOS设备。 如果我们为任何特定的设备(例如iPhone)设计了组件,那么该组件就可以在其他平台上使用,而无需进行最少的代码更改,就可以重用很多相同的组件。 例如,我们要重用专为iPad或Mac上的iPhone设计的选取器视图,则可以通过对代码进行一些更改来轻松实现,例如,iPhone选取器视图就像一个列表,而对于iPad则是弹出窗口,对于Mac,它是键盘快捷键。

The philosophy for SwiftUI is not to write once, apply everywhere but to learn once, apply anywhere.

SwiftUI的哲学不是只写一次,在任何地方都适用,而是一次学习,在任何地方都适用。

1. Declarative Syntax:

1.声明式语法:

With the help of declarative syntax, we can simply state what our UI should do. For example, we can write that we want an image with a circular shape having a white color border of width 5 pixels and also there should be a shadow of 15 pixels radius.

借助声明性语法,我们可以简单地声明UI应该做什么。 例如,我们可以这样写:我们想要一个具有白色边框的宽度为5像素的圆形图像,并且阴影的半径应该为15像素。

struct CircularImage: View {    var body: some View {        Image("swiftUILogo")            .clipShape(Circle())            .overlay(                Circle().stroke(Color.white, lineWidth: 5))            .shadow(radius: 15)    }}

This code snippet gives us an overview of the actual implementation of the above requirement. See how beautifully it is written with the help of SwiftUI and declarative syntax.

此代码段概述了上述要求的实际实现。 看看它在SwiftUI和声明性语法的帮助下编写得多么精美。

Declarative style even applies to complex concepts like animations.

声明式样式甚至适用于复杂的概念,例如动画。

Easily add or remove animations to almost any control and choose a collection of ready to use effects with only a few lines of code. At runtime, the system handles all of the steps needed to create a smooth movement and even deals with interruption to keep our app stable. With such type of feature, we will be looking for new ways to make our app come alive.

轻松地向几乎所有控件添加或删除动画,并仅需几行代码即可选择一组随时可用的效果。 在运行时,系统将处理创建平稳运动所需的所有步骤,甚至处理中断以保持我们的应用稳定。 借助此类功能,我们将寻找使我们的应用活跃起来的新方法。

2.设计工具 (2. Design Tools)

SwiftUI works seamlessly with the new Xcode design tool to keep our code and design perfectly in sync. Automatic support for dynamic type, dark mode, localization, and accessibility are some of its highlights.

SwiftUI与新的Xcode设计工具无缝协作,以使我们的代码和设计完美同步。 自动支持动态类型,暗模式,本地化和可访问性是它的一些亮点。

With the help of design tool our first line of SwiftUI code is already the most powerful UI code we have ever written.

借助设计工具,第一行SwiftUI代码已经是我们编写过的功能最强大的UI代码。

2.1 Drag and Drop

2.1拖放

We can arrange components within our UI by simply dragging the control on the canvas. We can also drag and control from our library and drop then on the design canvas or directly in the code.

我们只需在画布上拖动控件即可在UI中安排组件。 我们还可以从库中拖放控件,然后将其拖放到设计画布上或直接在代码中。

2.2 Dynamic Replacement

2.2动态替换

The Swift compiler and runtime are fully embedded throughout Xcode, so our app is constantly being built and run. The design canvas isn’t just an approximation of our UI but it’s the live app and Xcode swap edited code directly in our live app with dynamic replacement.

Swift编译器和运行时完全嵌入到整个Xcode中,因此我们的应用程序不断地构建和运行。 设计画布不仅仅是我们的UI的近似值,它是实时应用程序和Xcode在动态应用程序中直接通过动态替换交换已编辑的代码。

In the above visual, we can see how Preview canvas automatically getting updated.

在以上视觉效果中,我们可以看到预览画布如何自动更新。

2.3 Modifiers

2.3修饰符

We can easily drag and drop modifiers next to our views and they can be enhanced with new properties such as colors, transforms, visual effects, gestures, and many more.

我们可以轻松地将修改器拖放到视图旁边,并可以使用新属性(例如颜色,变换,视觉效果,手势等)来增强它们。

2.4 SF Symbols

2.4 SF符号

We can download the newest SF fonts from Apple website. Apple has provided more than 1000 icons in their new SF symbols app which can be used as vector assets in Xcode or in the design tool

我们可以从Apple网站下载最新的SF字体。 苹果在其新的SF Symbols应用程序中提供了1000多个图标,可用作Xcode或设计工具中的矢量资产

Conclusion

结论

It will be more straightforward to adapt SwiftUI as Swift keeps evolving and there are more and more new features that can help us to improve the productivity of the codebase.

随着Swift的不断发展,采用SwiftUI将变得更加直接,并且越来越多的新功能可以帮助我们提高代码库的生产力。

Any comments and feedback are welcome, so please share your thoughts. Thank you!

欢迎任何评论和反馈,请分享您的想法。 谢谢!

翻译自: https://medium.com/globant/dive-into-amazing-world-of-swiftui-f35a25c5e9ce

深度式睡眠潜入虚拟世界

http://www.taodudu.cc/news/show-4697094.html

相关文章:

  • bzoj5314: [Jsoi2018]潜入行动【树形dp】
  • Mac android原生工程中潜入react-native混合开发项目搭建
  • 【题解】P4516 [JSOI2018] 潜入行动
  • 【JSOI 2018】潜入行动(树形动态规划)
  • [bzoj5314][Jsoi2018]潜入行动_树形背包dp
  • unity游戏开发_stealth秘密潜入
  • upc 潜入苏拉玛 多源bfs + 并查集 + 思维
  • 【JSOI2018】潜入行动
  • 洛谷:P4516 [JSOI2018] 潜入行动(树形dp、树上分组背包统计方案数)
  • bzoj 5314 [Jsoi2018]潜入行动
  • 潜入js
  • JavaScript潜入潜出
  • 潜入密室
  • 队列潜入了解
  • YY一下VR游戏的潜入玩法
  • 潜入理解闭包
  • 口袋进化服务器维护,口袋进化平民攻略
  • 最大概率法分词中词频惩罚因子的作用探究
  • SpringBootc出现Parameter 0 of method modifyRequestBodyGatewayFilterFactory in org.springframework.clo
  • bzoj1116[POI2008]CLO*
  • dtree.js菜单列表加密,实现Code
  • BZOJ 1116 [POI2008]CLO 并查集
  • Java与Python下载Bing首页图片
  • clo*******e:项目管理随记
  • 穆迪分析在Chartis报告中被评为CLO解决方案类别领导者
  • 改造ueditor 在线图片功能 添加 删除 功能
  • [BZOJ1116] CLO
  • 1116: [POI2008]CLO
  • PLSQL导入CLOB超长字段常见问题
  • BZOJ 1116: [POI2008]CLO

深度式睡眠潜入虚拟世界_潜入swiftui的惊人世界相关推荐

  1. 深度学习中交叉熵_深度计算机视觉,用于检测高熵合金中的钽和铌碎片

    深度学习中交叉熵 计算机视觉 (Computer Vision) Deep Computer Vision is capable of doing object detection and image ...

  2. 深度学习之对象检测_深度学习时代您应该阅读的12篇文章,以了解对象检测

    深度学习之对象检测 前言 (Foreword) As the second article in the "Papers You Should Read" series, we a ...

  3. 构建基于体验式营销的虚拟世界

    构建基于体验式营销的虚拟世界 神说,要有光 这是一个虚幻而又真实的世界,这是一个充满乐趣而又无法预知的世界,这是一个人人都可以参与并创造的世界.在这个空间里,可以达成你在现实世界中无法达成的人生梦想- ...

  4. 深度学习用于视频检测_视频如何用于检测您的个性?

    深度学习用于视频检测 视频是新的第一印象! (Videos are the New First Impressions!) Think about the approximate number of ...

  5. 深度学习cnn人脸检测_用于对象检测的深度学习方法:解释了R-CNN

    深度学习cnn人脸检测 介绍 (Introduction) CNN's have been extensively used to classify images. But to detect an ...

  6. 深度学习背后的数学_深度学习背后的简单数学

    深度学习背后的数学 Deep learning is one of the most important pillars in machine learning models. It is based ...

  7. HTML网页猫咪主题,炫酷好玩的猫咪主题沉浸式装置艺术展:《猫的异想世界》...

    国内首个猫咪主题的沉浸式酷玩展--<猫的异想世界>Meow Meow Land 酷玩展,国际领先的多媒体技术加持,国内原创动画,顶级声音设计,现场真猫在场,零距离吸猫! <猫的异想世 ...

  8. jenkins 潜入网页_我潜入专业机器学习

    jenkins 潜入网页 I finished up my internship about a month back. The experience itself was hugely reward ...

  9. [bzoj5314][Jsoi2018]潜入行动_树形背包dp

    潜入行动 bzoj-5314 Jsoi-2018 题目大意:题目链接. 注释:略. 想法: 学长给我们除了一套考试题,三个学长一人一道这是T1. 好吧好吧,傻逼背包...... 复杂度$O(nk)$. ...

最新文章

  1. 云计算灾备原理与预防恢复方案
  2. LoadRunner的参数化功能分享
  3. 【CV秋季划】人脸美颜与风格化视频上新
  4. 两数组的交集(无重复)Intersection of Two Arrays
  5. sql group by having用法_神奇的 SQL 为什么 GROUP BY 之后不能直接引用原表中的列?...
  6. pytorch构建LSTM处理二分类任务
  7. LeetCode 300最长递增子序列
  8. 蓝桥杯2015年第六届C/C++省赛C组第二题-立方尾不变
  9. 从零开始学习 ASP.NET MVC 1.0 (四) View/Model 全解 【转】
  10. 自动驾驶—高精度地图or人工智能or其他
  11. 【论文解读】VDN( Variational Denoising Network )变分去噪网络
  12. 系统架构设计师考点全纪要(自己整理,本人一次稳过)
  13. 如果不想当程序员,学编程有什么用?答案显而易见!
  14. 精确控制Origin to Word图片格式、大小及主题使用技巧
  15. FFmpeg 直播黑屏问题分析解决
  16. C++中cv::Mat矩阵任意取其中一块或一行一列如何操作
  17. 阿朱:企业信息化十年
  18. 阿里云栖大会100位顶级大咖演讲PPT+视频全分享!
  19. 一、MySQL数据库设置默认时区
  20. swift UI专项训练21 网页浏览器

热门文章

  1. 第三部分 和弦铃声格式
  2. Java之父--Gosling
  3. 新媒体运营胡耀文教程:浅谈ToB市场精细化运营
  4. 大数据导论习题_2020智慧树答案 大数据概论 最新知到章节测试答案
  5. 炫龙毁灭者P6-581S1NR笔记本重装win10系统教程
  6. 因为是程序员,被亲戚鄙视了!
  7. python大众点评网实训报告中的参考文献_python小练习(052):爬取大众点评网美食版块+数据库储存+大数据分析(二)...
  8. 某些有趣的API接口(2)
  9. c#中out ref的简单使用说明
  10. vue3中的ref,toRef,toRefs三个的作用