Original: WWDC Initial Impressions
Chris Wagner
Translator: Kmyhy
Today is the most exciting day for Apple developers in the year!
The first day of WWDC brings many new APIs and new features, including Swift 3,sirikit,imessage Apps and more.
Starting with the section "Platforms state of the Union," I started writing documents, and I wanted to publish my first impressions of WWDC from a developer's perspective, perhaps a good idea.
Welcome all kinds of spit groove, all kinds of spray!
Swift 3
The most significant change for developers this year is the Swift 3, which will be released at the end of 2016, because it would make a very big difference to our swift code.
But if you've been looking at the Swift Evolution Project, there's nothing to be surprised about. Since Swift's reliance on open source, Apple and the community have struggled in the last 6 months, and everything has been discussed openly. Today's content is completely free of anything new, except for this: Swift 3 and Swift 2.3 are packaged into Xcode 8.
This solves one of my biggest grievances since last year: If I don't upgrade my source code to Swift 2, I won't be able to use Xcode 7. Since Xcode 8 includes Swift 2.3 (and Swift 2.2 is fully compatible with the source code), you can now open your Swift 2.2 project in Xcode 8 until you decide to upgrade to Swift 3.
If you are not concerned about the Swift 3 discussion, we will release a post tomorrow titled "What's New with Swift 3". At the same time, I would like to mention another thing that affects us all.
Objective-c API More "Swift"
One of the biggest changes in Swift 3 is that Apple has made its APIs more "Swift".
The following example will make it easy for you to understand this. Here is an example of using a string:
2.2let content = listItemView.text.stringByTrimmingCharactersInSet( NSCharacterSet.whitespaceAndNewlineCharacterSet3let content = listItemView.text.trimming(.whitespaceAndNewlines)
Note that the version of Swift 3 is more concise, and it uses enumerations differently.
This is an example of using the Core Graphics:
Swift2.2LetContext= Uigraphicsgetcurrentcontext () cgcontextmovetopoint (Context,5,0) Cgcontextaddlinetopoint (Context,Ten,Ten) Cgcontextaddlinetopoint (Context,0,Ten) Cgcontextclosepath (Context)//Swift3LetContext= Uigraphicsgetcurrentcontext ()!Context. MoveTo (x:5Y:0)Context. Addlineto (x:TenY:Ten)Context. Addlineto (x:0Y:Ten)Context. Closepath ()
Note that calling the global C function becomes the method that calls the context.
Then there is an example of calling GCD, and the API invocation is simplified:
// Swift 2.2letqueue= dispatch_queue_create("myqueue", nil)dispatch_async(queue) { // do stuff}// Swift 3letqueue="myqueue")queue.async { // do stuff}
As you can see, the long name is abbreviated to a short but clear code, while the original global function is modified to the corresponding type of member method.
For skilled developers, this change will take some time to adapt, but once you stick to it, you'll be able to make your code more concise and better suited to the developers you've just contacted. Xcode 8 comes with a migration tool that allows you to upgrade your old code to Swift 3, which will save you a lot of effort.
I am really happy with these changes because these new APIs will eventually become more intuitive.
Note: To learn more, please read Apple's API Design guidelines and Better translation of Objective-c APIs into Swift.
IPad version of Swift Playgrounds
Since the advent of the ipad Prod, developers have been looking to launch Xcode on the ipad.
We won't comment on this, but at least the introduction of Swift Playgrounds on the IPad shows that this is a good start. It's a lot like the Playgrounds we knew before, but adding a nice keyboard and UI makes it easier to write code and a beginner's tutorial.
It seems to be a good fit to teach students about Swift as the first programming language, but also useful for sophisticated programmers to validate some prototype code.
Xcode 8
If Xcode doesn't have a major version of the upgrade, it's not WWDC!
I am here to list some of the most important aspects of this upgrade.
Memory Debugger
One of the most exhilarating upgrades is the memory debugger for Xcode 8.
This is a built-in basis that allows you to view all the memory objects in a running App graphically, so you can quickly discover memory leaks and circular references. Once you find the problem in the chart, you can select it, view the stack for each frame and jump directly to the line of code where the problem occurred. It's so addictive!
In addition, the new memory debugger can automatically detect memory leaks and help you diagnose problems quickly. The presentation was wonderful and the audience cheered. Loop hold, Bye-bye!
Improvement of Interface Builder
Have you ever wanted to zoom in Interface Builder and then drag a button? But soon you'll wake up, unless you're at a 100% magnification, and you can't do that?
Yes, it's a past style! Now the Interface Builder in Xcode allows you to edit the scene at any zoom rate.
A new toolbar is also added to allow you to easily preview the view controller under different devices and Size classes (iPhone, ipad, etc.) and to identify conflicting layout constraints before build&run. It really saved a lot of time.
Source Editing
Xcode 8 has improved the code editor to automatically integrate picture assets in your project into your code in the form of picture previews:
To do this, you just enter the image name and you get a non-nullable UIImage instance.
In addition, Xcode 8 can be displayed and defined in code in a consistent color:
All it takes is you enter color in the Code editor and select the "Swift Color Literal" menu, and a color selector appears immediately.
You can also create Code Editor extensions to customize the experience when writing code. Now that Xcode has added this new template, when you've finished writing this extension, you can publish it via the Mac App Store or a binary file signed with your developer account. I am looking forward to seeing you open such an extension!
Performance improvements
Apple claims that Xcode 8 is much faster in many ways than before-for example, index testing is 50 times times faster than before.
Speed improvement means more efficiency for developers, which is really a great news!
IOS SDK
The IOS SDK adds a number of new kits, extensions, and enhancements to existing frameworks. Here's a small list of what I think is important.
SiriKit
One feature developers have long awaited is the ability to integrate Siri. Added sirikit! in IOS 10
SiriKit rules that you can use Siri in your app's 6-class business:
- Voice or video telephony
- News
- Pay or Accept Payment
- Photo Search
- Booking itinerary
- Health Management
If your app has the above features, you can expose a Intents extension in the app. Siri is responsible for addressing nuances in language conversion and semantic analysis, translating user requests into actions that your Intents extension can handle. When the app receives a Intent from Siri or Maps, you can even display your own UI.
You must provide some details in your extension so that the system knows that your app can handle some of the user's requests, and if you understand the development of app extensions in IOS 8, it's easy to develop a Siri extension.
Note: For more information, please read Sirikit Programming Guide.
IMessage Apps
As a user of Slack and Facebook messager, I am particularly excited about these enhancements to the message. Animated GIF pictures and firework, finally come in handy!
In Keynote, Apple demonstrated a bunch of cool new features, such as Link/media unfurling, reactions, message bubbles, and window effects, but I'm not quite sure how to do that. During the presentation, when I was thinking "they'd better declare an extension that allows third-party developers to get into the messaging platform," they've done it. With the new Messages framework, you can create extensions that let users send text, emoticons, media, files, and one of the most interesting things: interactive messaging.
Emoticons Pack
The simplest extension is similar to the expression pack. Creating emoji packs is incredibly easy, and you can define a set of emoticons that users can send to friends. If you've ever used Facebook Messenger, you'll find it looks like Messenger, except for one thing: emoticons can be "opened" and placed on top of other messages. To tell the truth, it's a bit of a gimmick, but it's still interesting:]
Interactive experience
It's not just a smiley bag. This APIs allows you to create new experiences in the Messages app and even customize ui! Services like Giphy are undoubtedly interesting, and you can offer extensions like this that are much better than the third-party keyboards today. Of course, it's also very powerful in the business environment!
Imagine a service company whose technical team uses Messages to communicate. They can use this extension to access the data of the CRM system (in the message) so that the information is delivered to everyone quickly. With interactive messaging, each party can be initiated with a single message. Keynote gives an example of creating a group buy menu that everyone in the group chat can modify before the menu is sent.
I can expect thousands of apps to benefit from it. From a user's point of view, I am very happy to see this day coming.
Note: For more information, please read the messages Framework Reference.
User Notifications
Added a new framework Usernotificationui that allows developers to create rich media notifications, which are completely impossible before.
For example, you can now embed rich media in notifications just like the built-in Messages app. This is achieved through a new extension, which is called when the notification arrives, and this function looks very powerful. You can even use this notification extension to implement an end-to-end encryption layer. I don't have time to look at this part of the content, see the conference video for more details on this section, or read the Usernotifications framework reference.
Widgets Big changed
In IOS 10, Widgets completely changed, and I agree with both hands. I was excited about widgets when I was in IOS 8, but then widgets stayed in the notification center for a long time and was less excited.
Now, widgets is on the left side of the Home screen, just like they do on MacOS. Widgets can also be displayed by using the 3D Touch shortcut menu above/below the app icon. In my opinion, it's more natural to look at the quick information in this way. It's like you're peeking into the app's content.
WatchOS 3
There is a general view that the Apple Watch platform has failed in its attitude towards app developers. Although it is very attractive, the core function is very good, but it has a congenital defect from the beginning: speed.
It's a pain to start an app on watch. Usually you will see a small circle in turn, almost 20-30 seconds to disappear, and even completely shut down, make you feel annoyed. Eventually you'll hide the watch in a drawer, sell it, or just wear it as a clock, or look at the notice.
When Kevin Lynch opened keynote and talked about their focus on getting the app to start quickly, I burst into tears! If that's true, I'm starting to have confidence in WatchOS development:]
Speed improvement
The Apple watch speed boost is followed by the introduction of snapshots, Dock, and background tasks. These three combine to allow the Watch app to be ready at any time, and the user opens a bit.
Snapshots and background tasks are not the same as IOS:
- The system screens the UI via snapshots and uses it in the app's startup and switchover.
- With background tasks, your app can have some time in the background to update the information so that the data is ready when the app opens.
You can use SceneKit and SpriteKit.
You can now use SceneKit and SpriteKit in the Watch app. The first thing I thought about was using them in the game, but Apple showed another way to use it: create beautiful custom animations for regular apps.
The current limitation on watch is that developers cannot create custom animations UIKit. But in WatchOS 3, you can package your. scn files in your resources so that you can add 3D graphics to your app. or use a. sks file to create an interactive 2D animation. This is interesting, think about what developers can use to do?
The improvement of complication
When users add your complication to the dial of their WatchOS 3 device, you can get your app ready to start and receive 50 push notifications per day. If you're interested in the app's data, that's enough to motivate you to make a complication. Even if sometimes complication data doesn't make sense to the user, it can also speed up the app launch.
TvOS 10
TvOS 10 is not so much changed.
TV provider now has the concept of SSO (Single Sign-on), the user only needs to authorize provider once, and then can not login in all supported video channel apps. If you are developing an app that needs to use this feature, refer to the Videosubscriberaccount framework.
TvOS's most interesting upgrade is the opening of many existing frameworks to developers:
- Externalaccessory
- HomeKit
- Multipeerconnectivity
- Photos
- Replaykit
- Usernotifications
MacOS
OSX was renamed MacOS after 15 years of existence to align with the names of the other three platforms. The latest version of MacOS is MacOS Sierra.
I'm not a macOS developer, so I can't talk too much here. But I'll focus on a feature I'm most interested in.
Apple pay for the Web
Users who use MacOS Sierra can now pay on the web using Apple paid.
This is important for web developers of e-commerce sites, because it lowers the user's payment threshold to a level completely. Because it is no longer necessary to be responsible for the security of the user's credit card data--even better, letting users know that their credit card information will not be saved on various websites, making it easier to gain their trust.
As far as I know, there is no reason (unless expressly provided by law) to support Apple pay on your website. This process requires a framework of [Apple Pay JavaScript] (the Apple Pay JavaScript framework).
Apple FileSystem (Apple file System)
Last but not least, I want something relatively cross-platform: Apple has released a new file system!
I've never heard John Siracusa mention this filesystem in my blog, which is a bit of a surprise. This improvement is clearly deliberate!
The current file system defaults to hfs+, which appeared in 1998, when a floppy disk was still in use. Most of them are now-I've looked at it, even the most basic iMac is using a 5400-rpm drive-and newer systems use SSDS with high-speed flash. The Apple file system is formally designed based on FLASH/SSD and also supports local encryption.
From the Apple file system, users will receive the following benefits, such as crash protection, space sharing, cloning, and snapshots. Crash protection uses a copy-on-write metadata mechanism to ensure that upgrades to the file system do not have to worry about crashes, while reducing the log size used on the hfs+. Space sharing allows multiple file systems on the same disk to share the remaining space on the disk without having to repartition the drive.
Clones can create real-time copies of files and directories without consuming disk space. Because of the copy-on-write mechanism, cloning files and directories does not actually replicate unless there is a modification action occurring. *nix users might think of symbolic links, which is the first thing I think about, but I'm sure it's far from the symbolic link. The last is a snapshot (snapshot), which allows a read-only instance of the system plug-in data so that the data can be recovered at any point in time.
Conclusion
This is the end of my initial impression of the "New Year's benefits" that Apple has issued this year.
As I mentioned, I have no time to focus on all aspects, and there are probably some good things missing. If you find something wrong, please let me know and I will be happy to update the content in a timely manner.
At the same time, we will do our best to launch a series of new documentation tutorials, video tutorials and books in the next few weeks. Please pay attention.
WWDC 2016 Impressions Preliminary