Crafting Modern Cocoa Apps - Apple WWDC 2016

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello welcome to crafting modern collapse my name is Corbin Dunn and I'm gonna give this talk with my colleague Jeff we're both apt-get software engineers so let's jump right into it what are we gonna talk about today we have a whole bunch of subjects we're going to talk about getting a modern look drag and drop and how to do correctly container view controls table views using some system appearances designing with storyboards and some other cool Mac features tons of stuff which we're gonna highlight with a quick demo app that we have that we see in this screenshot highlights a lot of the new features or existing features they can adopt and all these technologies most everything you can use already on Mac OS 10 10 or 10 11 anything new - 10 12 we will specifically highlight and point out and this demo app we encourage you to download it it's not quite available yet but it will be soon and will be associated with the talk so let's jump right into it and talk about creating a modern look with modern views and what you can do there so modern look means a modern window and a modern toolbar such as shown in this demo up here one thing you want to be doing is using a full-size content view the full-size content view allows your content view to extend underneath the toolbar area that I'm highlighting here in white and that means that full-size content view will have its area automatically blurred by the title bar and toolbar area without you having to do anything using the full size content view is really easy it's just a window style mask you can use the dot full size content view bit on it to include it or if you're using interface builder you can just check a checkbox full size content view and you get it so if you're using the full size content view you may need to offset your content underneath it for instance let's say that we have something that we want underneath that title bar toolbar area we might want to put like a label or some there if we put that label there how do we get it under that tattoo bar toolbar area which might have say a dynamic height that would change and we want that label to not have a hard-coded Y offset because hard coding offsets would be really bad so what we have is we have the content layout rect property on in this window this is a key value observable a kvo observable property which you can use to find out whenever the content layout rect the area in turquoise changes so you could go and place your view directly underneath the title bar toolbar area based on that but we also encourage you to be using auto layout and if you're using auto layout you can use the content layout guide which is a property on in this window for instance inside of your in this view controller subclass might be overriding update view constraints and you want to create a constraint you grab the windows content layout guide take the top anchor for it and you have your text field and you create a constraint to that text fields top anchor also and activate it and if you do that that text field will automatically be below that title bar toolbar area without you having to do anything it's very simple to do next for a modern app you might be wanting to use a streamlined toolbar so here is a screen shot of a normal application the things to notice here is it's got a explicit title bar or sorry it's got explicit title up at the top and you would have an icon there if the app actually had an icon for this document if I go to using a streamline toolbar that title disappears the toolbar is pushed up a little bit and the window buttons the close button etc are directly inline with that title bar toolbar area to do this it's really simple and all you have to do is set the title visibility property to dot hidden and that title will be hidden the toolbar be pushed up and everything will be inline when do you want to do this you probably want to do this for applications that are kind of like shoebox applications for instance Maps calendar system preferences things of that nature there kind of like one one window applications are good for this type of look so what other things may you want could you want to do well you might want to compliment that title bar toolbar area with accessory view controllers for instance you might want to have an accessory view controller that's right below the title bar and by doing this you want to automatically be blurred without you having to do anything the size to be automatically changing as the windows resized without you having to do anything so how do you do this it's really simple we have a view controller subclass call it in its title bar accessory view controller instead of view to that view controller in addition it exposes a layout attribute so the layout rebuke could be set to dot bottom which means hey this accessory is gonna be on the bottom of the title bar area and notice the text appeared below it it because again we're using the proper content layout wrapped and content layout guide without having to do anything in addition to the bottom the layout attribute could be set to leading or trailing and this means you get a accessory view controller up in your title bar area such as a register me button or something else you might want up there nuta Mac OS 10 12 is the ability to use leading and trailing as opposed to using left and right which were published before we prefer you to use leading and trailing because it allows your window to work better when you're using a right-to-left localization so for instance if I'm just running this in pseudo right-to-left mode you can see that that SS review controller automatically flips to the other side without having to do anything next we the system may actually be adding our own accessory view controllers to your window for instance we might be using it for creation of tab windows where we aggregate multiple windows into one sort of virtual window so how do we do tab windows and what do you do as developer you don't really have to do anything if you order a window front what we do is we look for windows that are similar to that window and by similar I mean we look for the tabbing identifier property if it has the same tabbing identifier we're gonna prefer to aggregate those windows into one single tabbed window the windows themselves are all considered visible even though it might be in a hidden tab but we actually hide them with respect to core graphics if you're using this document a lot of the things such as the plus button inside the tab bar work automatically without you having to support anything but if you aren't using this document you can implement a responder chain method new window for tab to create a new document or a new window on the plus button for more information check out the what's new in Cocoa talk to see more details on this for more information on the title bars the assess review controllers and how they interact with fullscreen I highly recommend seeing the talk from 2015 on improving the fullscreen window experience next let's talk a little bit about core animation so what is core animation well it's a graphics rendering engine that does a lot of the work on the GPU as opposed to the CPU so everything can be very fast for scrolling we can do very fast and smooth animations and the base component of this is a CA layer how we actually create your layout and your views using layers or views and cells so this is an example animation where you might have like a background layer a middle layer and then a front layer actually doing an animation so you want to compose your views of multiple sub views to create the final look let's take a look at some of the properties in core animation or see a layer that allow you to set the contents of what you see on screen speaking of content CL air has a contents property the contents property can be an innocent or a cg image ref that actually represents what you see for that layers contents but you could also set other properties on CA layer such as the background color the border color the border width the the corner radius there are more properties you can take a look at see you layer to see the other things that are available and how to control so these are some of the intrinsic basic ways to actually set how I see a layer will look and we're going to talk a little bit more about this in a second but what you should be doing is you should be using a layer backed view so you're gonna be using Innis views set once layer to yes which I'll show in a second how to do that and that will implicitly create a layer for you and that means that you can provide the layer contents via draw method but if you're using layers will actually have two more important methods update layer and wants update layer and in just a second I'm going to show how these come into play and when you want to use them so what do we actually recommend for using coordination or when should you use corn amasian and layer backing well we recommend that you layer back your Windows content view and when you layer back one particular view all the children will automatically get layer back for you too without you having to opt into a layer for every individual child view we recommend that you layer back views and you not use CL layers directly add it as a sub layer because that takes care of some things automatically for you such as when a layer is shown on a Retina display we'll do some more set up that takes care of the work turning on layer backing is really simple on the content view of your window you can set once layer to true and code or of course you can just go ahead and inside interface builder and check the check box for core animation layer on a topmost view so an important property on layer back views is the layer contents redraw policy you want to set this to on set needs display which is not the default value for in this view what this means is you as the developer whenever you want the contents of your layer or the view to change you have to call set needs display this is slightly different semantics in the way normal views would work where they might actually redisplay as they're moving across changing a frame origin so it's something you need to explicitly opt into and it's better for performance particularly with animations so how do you actually get contents into your lair so let's say your view is dirty you mark set needs display and what we do is we ask your view hey what do you do for one set date layer what's your answer for wants update layer and here we fork if you say yes for wants update layer then we're gonna call update layer if you say no we're gonna call draw rect so this is a complete Fork it's an either/or then you may be wondering well when should I use update layer versus draw rect this gets back to what I was showing about core animation and I see a layer properties so if you can represent your views representation directly by setting CL air properties then you probably want to use update layer it's gonna be more efficient so if you can set the layer of contents layer background color prefer to do that if you can't then that's the point where you want to override override draw or draw rect and actually do your manual drawing inside of the subclass the thing about doing this is that every view which implements draw rect will get its own unique little backing store which you can think of as an image and so if you have a lot of those it might be expensive in particular from memory let's take a quick look at an example of using update layer and how you would use it so first of all you override wants update layer say that you want to get an update Lehrer call back by responding with a true and then you're gonna get a call back to update layer where you can actually set the layer properties so we access the views property self layer contents and the self layer background color or whatever other things you want to set and you said at this time so that was talking about modern views and creating a modern look with the title bar toolbar let's talk about drag and drop and do some event tracking so modern drag-and-drop what you should be doing is adopting drag flocking as shown in this video right here drag flocking is where each item will move independently and flock together or unlock together and when you let go of the mouse they'll actually all flock back to where their original location was to use drag flocking you just use in this views method begin dragging session and you pass an array of the actual items that you want have be dragged around it's very simple to do for more complex controls like a table view or collection do we provide delegate methods for you to adopt these so for table view you should really be preferring the delegate method table view paid sport rider for a row where it can provide an individual in this page board writing item for every item in a table view that's being dragged as opposed to the older method table view right rows with to a paste board where you would have written everything in one go to the paste board similarly collection view has a there are two has two delegate methods that look very similar to that and for collection view you should also prefer the paste board where for item at version as opposed to the other version so with drag flocking new to Mac OS 1012 is the support for drag file promises this may be a reason why you weren't using graph locking up until this point and you can use NS file promised receiver and in this file promise provider to do reading and writing a file promises take a look at the talk what's new in cocoa for more information and more details on this so let's take a look at event tracking and let's say you have your window here and let's say it has a button up at the top so you have this button and what you want to happen is that when you click on that button down and up it works like a normal button you'll do some action like showing a popover but you also want to be where you click on that button and if you actually drag the mouse it starts a window drag so how do you get both those behaviors together in a proper modern way that works well with modern system features well first of all let's talk about event tracking and how you'll track events to do this in this window has a method track matching masks with a timeout a mode handler and the handler is a block callback we prefer that you use this as opposed to the older method on in its application which was next event matching mask with the older method you would create your own loop with the newer method you just get a block called out to do your work taking a look at a block callback let's say in that button we subclass and override Mouse down the first thing we're gonna do inside this mouse down is call window track events we want to track all the events for the drag and the left mouse up if the user did a click just sit down and back up then we're gonna just be like we're gonna stop and we're gonna say oh we're gonna call yes for super because that way everything will work normal like an in is button but here's the extra part let's say you click and you drag and if you click and drag inside this button we're gonna figure out if you went far enough if you went far enough we're gonna pass off to the window to do a perform drag and so what that means is when you pass off to the perform drag of the window the window and the system is going to take over dragging the window at that point you should not be dragging and moving a window by calling set frame again and again in on window if you pass off to the system as soon as you pass it off if your application hangs then that window will continue to be moveable even if your application is spinning in addition other system features will work such as space switching the spaces bar will drop down when you move to the top of the window windows snapping window alignment any other new system features we add with window movement will automatically work without you having to do anything so we encourage you to pass off to the system by calling perform drag so that was talking about drag and drop a little bit about event handling let's talk about container view controls and how to handle this properly so container feed controls we should be using the view based table view at this point and you do that by using the delegate method table view view for or inside of a interface builder you can set things up directly in an interface builder itself and why you want to do it is so you can get what we saw in that video new features such as swipe to delete which only exists in the view base table view to do the swipe to delete some very simple there's a table view method row actions for row on a particular edge the left or the right edge or sorry leading or trailing edge and you can return an array of one or more or a zero or more row actions and then in stable view row action allows you to create a string value for what the title is of the button and a handler to actually do the code that happens when the user clicks on the button or swipes far enough to actually invoke it next let's talk about scroll view and that complex control so if we're using all these technologies we talked about let's say that we take this role view or would say we take the window and set the window property title bar appears transparent which makes the title bar appear transparent applications like messages take advantage of this to all the contents to show underneath so here we can see what's happening that scroll view on the side is showing the content underneath the top of our toolbar area and would automatically blur with it but this presents a dilemma how do you get that scroll view to automatically be inset so that you don't have to add in like an extra empty row or anything really weird and it's very convenient and easy to do this scroll view has a method or a property called content in sets that allows you to drop the content down a little bit in fact we can do it automatically so we have a property automatically adjusts content in sets if you set that to true then what we're gonna do is scroll view is gonna use kvo to track the content layout rect that we talked about earlier and automatically set the content in sets to be the appropriate value for you but you as the developer may actually want more control the content in sets you might want to drop it down even further and add some other accessories there such as like a search field or something else and an example of where we do this in the system mail drops it down a little bit and adds another sort indicator that's how we accomplish things like that in our system applications next let's talk about Auto layout you should be using Auto layout and you should be using base localization which means that all your nibs should be in beta lproj instead of multiple copies of different folders and different localizations shouldn't use fixed width width constraints you want to use controls to have engine intrinsic content sizes instead of hard-coding sizes prefer to use stack view use leading and trailing attributes all these things are right for creating a properly localized application but let's take a look at some of the localization options in IB in particular let's look at this text Direction layout and mirror section so the text Direction has three values it has natural left to right and right to left natural means that the actual control is going to look at the string value that you set on that control like a text field looking the string value and if that string is a right-to-left string then we will actually put in the direction right-to-left if it's a left-to-right string we'll put and left-to-right or you can manually control it by setting these two left to right or right to left the next property is the user interface layout direction which is key to layout and it has either left to right or right to left system controls such as table view we'll look at this property and may do things like automatically flipping the table columns when it's set to right-to-left the default here is based on the app value but the interesting thing is the mirroring property because it's a little confusing so if mirroring is set to automatically then that user interface layout direction the last property we just looked out will automatically go from left to right to right to left when it's in a right-to-left localization and vice versa and we'll also flip other properties automatically like the cell image position for a button so the buttons images on the left and we'll flip it and put it on the right for you automatically but one property that we won't flip is on text alignment if you have it set to center justifier natural those don't really make sense to flip so we won't flip them so then you might be wondering well when do I actually not want to have mirroring well you might want to have mirroring sets know when you want a control that has a very physical representation like a play button a fast word button or a rewind button and then these are all interface builder things so how do you actually do this in code so in code you'll actually have to look at your controls value for the user interface layout direction if it's set to left or right then you're gonna have to say hey button I want that image to be on the left when it's in a left-to-right localization and I want that image to be on the right when it's in a right-to-left localization you have to manually do this but to make it a little bit easier in ten twelve we added a convenience method on button an init method which allows you to pass a string and image target and an action and have the flipping automatically happen for you so that's it for my first section I'm gonna bring up Jeff to talk about appearances storyboards and some other Mac features thank you all right thanks Corbin we got an absolute ton of stuff to cover in this section so I'm gonna dive right in with system appearances so here's a rap we've been looking at it for a while now and we're trying to develop our Ruy a little bit and we've decided that we want to adopt this really slick dark look this is kind of characteristic of Pro Apps usually and we're nothing if not ambitious with our little demo app here but look at this this looks really complicated we have entirely different system or window.chrome we need our lower control artwork to change segmented controls buttons sliders and all of our text labels need to need to invert from dark text to light text which seems like an awful lot of work but actually we can do it in one line of code using honest appearance all we gotta do is create one of our system appearances assign it to the window and it's automatically applied to everything within you can think of an appearance as sort of a palette of colors and artwork that we use to resolve how to draw all of our standard system controls and also all of our named colors these are things like label color control color and for that reason it's really important that you use these colors when applicable not only do you fit in better with the entire system theme but you'll continue to fit in if that themes Inge's in the future or if you change your appearance in the future so let's take a closer look here we've got a panel it's got tons of nice labels controls etc on it and all we have to do is just apply dark appearance and we see a pretty dramatic change our control artwork has changed and all of our labels have of course inverted from dark to light we can actually take it one step further and apply this cool vibrancy effect you may have noticed a slide ago that the appearance that we applied it's called vibrant dark that doesn't mean that you're obligated to use vibrancy but it does mean that the artwork looks great in a vibrant context and to get this appearance all you need to do is add all of your controls as a subview of a nice visual effect view and you'll automatically get this great behind window blurring and also this cool blend effect for everything on top now you might be thinking that's great and all but my designer has this really cool like specific color that they want for our text labels and so I'm not gonna use label color I think that you know I'm not planning on changing from dark to light or vice versa so I'm fine right I'm safe Oh have some food for thought let's check at let's check in with the the accessibility prep union we're gonna turn on this setting in the middle here called an increased contrast and let's see what that does to our UI on the Left we again have our standard panel but on the right we have that panel with increased contrast turned on and although we haven't inverted all of our colors this transformation is every bit as dramatic as the transformation from light to dark you can see that the window background color has gotten lighter our text is darker at every level and all of our controls have gotten this really nice bold outline it makes it really pop against the background now when you provide a hard-coded color value we can't really second-guess that we can't adjust for settings like this and so if you if you don't supply things like label call or a secondary label color you might be doing a real disservice to people who need settings like increased contrast to get the most out of their Mac now I hinted a moment ago at visual effect view and vibrancy we're not going to go into depth on that API right now but I would refer you back to our talk in 2014 that's adopting the advanced features of the new UI of OS 10 Yosemite that's appearances it's a real simple way to phim your application while remaining harmonious with the overall look of the operating system next up storyboards storyboards are technology they allow you to design not only the individual components and the views that comprise them for your application but also visually design the relationships between those components in this case when I say components storyboards operate in terms of controllers those are window controllers and view controllers and we connect them together with these things called segues those are the arrow is up there on my screen shot and segues abstract away all of the glue code of putting these components together those are things like adding sub views adding constraints creating popovers really just housekeeping now one thing that we need to think about with with storyboards is when we have separable components like these you can see I've got a split view here and you can see the storyboard that creates it all these little components are their own little thing that every piece of UI has some kind of data that it wants to look at or you know modify and we can't necessarily just drag outlets or actions from one scene to another of course if we did that they would not be separable components anymore then we have defeated the purpose of this whole thing but sometimes this data that we're working on doesn't really live canonically in the scene that we have here and our leaf node sometimes it might move all the way up on the window or in the document so how do we propagate that data all the way up from the top level down into our leaf nodes well we have a couple of rules of thumb not hard and fast rules but just a couple of ideas that we think are good for for handling this from one the dependencies should generally cascade downward if you're wondering you know if you need some kind of rule of thumb for this just follow the arrows in your segues if nothing else this gives you a nice unidirectional information flow in your application and that makes it a lot easier to reason about next try to reduce the amount of assumptions about your UI structure that you hard code into your code now you just got done designing your UI and your storyboard and if you're hard code assumptions about how that structure is put together in your code now when you want to make a change to your storyboard you're going back and forth you got to change your code change your storyboard and now you're fighting yourself let's not do that let's make our let's have our code focus on our data and focus on designing our interface and interface builder and what technique that we can use to address that is to use protocol conformance --is to work really generically across our UI so here's an example let's say we have this property here it's up on our window controller and we want to automatically provide that property to anything in our view hierarchy that understands it so in our dead set we're going to go ahead and call this propagate method and we've got this protocol that we defined off screen called photo controller consumer and this just says I know how to do something with a photo controller and so if we look at a child view controller and see that it conforms to that protocol we can set the property and then we also automatically propagate recursively to all of its children but what about things like popovers or you know sheet presentations things that are kind of on demand these probably don't exist when you're setting a property like that and we need to be able to provide their data on demand before they show up on screen that's exactly what the prepare for segue method is for this is called on the presenting view controller or window controller at the time that the presentation occurs and in this case instead of doing something like in like inspecting our segue identifier forcibly casting to the controller class that we expect it to be and then doing some kind of specific setup here we're just doing the exact same thing we're checking out what protocols it conforms to and then studying the property appropriately and what this does is it changes our logic from focusing really strictly on identity into capability we're saying I have this knowledge and anything that's presented off of me could potentially gain that knowledge automatically through a protocol conformance it's really handy but what about actions it's really frequent that the best object to handle an action that's triggered in UI is not actually in the same scene that the control is defined in and this is exemplified by menu items which are in their own little scene completely disconnected from your UI and luckily we have a really great mechanism for handling this case and that's the responder chain if you're coming from a platform like iOS where maybe you don't use the responder chain quite so heavily that is that little orange cube that is in the top of every storyboard scene that's a proxy for the first responder and so if you hook up an action from the control to that to that proxy it'll automatically be sent up the responder chain when the control is invoked but what if there's no object in the responder chain that handles your method or what if in the case of zoom in it's not always appropriate to send that action for example we might be at our maximum zoom level and so we don't want our zoom in button to just do nothing and we should be able to look before we leap with our action and that's what you buy validation is for so let's take a look at a block of code that would inspect UI validation to determine if a control is actionable the first thing that we're gonna do is ask Ana SAP for the target for an action from a control and what that does is it automatically walks they're smarter chain and find some object that implements that action or it might not find any action or it might not find any object at all the first case we want to look at for the results there is any object that implements the NS user interface validations protocol and this just means you can ask me proactively if the control is valid and so if you're on the other side of this equation and you have a control that is conditionally valid you can implement this method and controls like NS menu item and toolbar item will automatically validate against that method so we can ask that method and then of course we also have the cases of some object that just handles the method unconditionally or no object at all which clearly means that we're not prepared to do that action those are some techniques for dealing with storyboards so now we've been talking a lot about the kind of design time facets of building your app let's look at some more user facing features that really help you make the most out of our platform and the first of those is user activities and this user activity is this object that describes kind of what your app is doing right now what does what is it viewing what is it editing etc and this is the object that's used by handoff to move those activities between devices it kind of takes your whole context it moves it between I don't have time to go into the entire API in depth right now but I do want to highlight how simple of an object this really is you construct it with an activity type and that is a unique identifier that describes the activity that you're doing and this is also a key that you were put into your info.plist to declare I'm a good app to pick up this activity on another device and then you're just filling some basic configuration figuration info to describe your activity a nice user-facing title and also some user info basically just the most basic amount of data necessary to jump back into that task at a later time we want to keep this dictionary small because it's often transmitted wirelessly and we definitely want our hand off interaction to be fast we also get an opportunity in the delegate to add the absolute latest information about our context right before or at some point before we perform a handoff and this is called at some point after you mark an activity as needing to be saved and we'll call this method for you so you can fill in that in the latest data now how do we decide what activity is the current activity because of course we need to certainly determine what is being looked at right now well you can manually manage that with the become current and resign current methods on and as user activity that means that you're probably going to have to follow your user around your application figuring out what they clicked on and trying to figure out what they're doing app can make this a lot easier by allowing you to attach to attach activities to the responder change for automatic management for an example of this let's say we're building a calendar app which looks a lot like our calendar app and we have two activities that we want to put into our responder chain we've got a higher-level activity for the view that we're looking at this whole this day view that we have here and then we have a much more specific activity for the specific event that we want to view you know there and by attaching these to the responder chain when we click that event and make it their first responder that activity becomes the closest thing in the responder chain to the first responder and it becomes current automatically now you may not have considered handoff the NS user activity API before maybe you don't have a companion iOS app or you just haven't really thought that handoff is especially compelling for your application and your specific needs but activities are not just for handoff new and Ciara we have Siri on the Mac and Siri uses the current activity to provide context to commands so for example if you say remind me about this at some date so he's gonna infer this to mean your current activity and it'll actually even take that activity and embed it inside of your reminders that you can pick it up in the future so we see activities as a generalized mechanism for describing this kind of information it's not just for handoff now for full information about the handoff API I recommend checking out this talk from 2014 adopting handoff when I was 10 and iOS that had covers a lot more of the advanced topics like continuation streams which allow you to move a lot of data between devices the next feature resume which we sometimes call state restoration it's one of the best features on the Mac is that when you quit an application and then relaunch it it comes back exactly the way you left it in fact that happens if you crash an application or even reboot your machine everything just comes back exactly the way that it was now clearly to accomplish this if a complex effect we need to save all of the UI state that builds up over time and then restore it when the app relaunch is well clearly we don't want to save that state in our model it doesn't really belong there so the state restoration API gives you a distinct place to save that UI state separately and it gives you a good place to restore that state when you're launching but before your UI has gone up on screen you enable it on a per window basis it's pretty simple you just say is restorable is true and then you may provide a restoration class that just handles the the act of creating your windows from the encoded data and good news if you're using an S document and as document handles us all for you now what kind of statement we want to restore well we might choose to save the current tool that were that we have active in our app we might also want to save the state of the sidebar what's selected what our scroll offset is how do we do that well if you use NS coding before it's really really simple the first method in codes include record restorable state with coder you implement this on any NS responder method and then it's just like using NS coding but for your controllers effectively another important call is invalidate restorable state and this just says whatever my backing data is for encode restorable state has changed in some way and we'll schedule to make sure that we save that state again sometime in the future and then finally restoring is just as easy it's exactly that like you would expect it's a lot like an it with coder I have to do is called super decode all the save data that you've encoded before and then instead of beer your white based on that information that you've encoded now that's pretty easy but we can actually make it even easier all you have to do is implement a class method restorable state key paths of course we're gonna ask super because that's the polite thing to do but then we also append our own key paths and these are two properties that you want to have automatically restored or saved and restored by the system these properties need to be kvc because key value coding accessible because we access them by key path and they also need to be observable so that we can observe them and invalidate your state when they change and that's state restoration third and final technology you want to talk about documents in the cloud so once upon a time to opt into documents in the cloud you actually had to proactively opt in and create a container but these days with iCloud drive and now especially iCloud desktop and documents it's more likely than ever that your app is working with documents that live in iCloud now this is important because new and 10:12 local copies of documents might be evicted to free up space and this means that you might be working with documents that aren't actually on the local hard disk so how do we handle this that seems pretty scary luckily you first off if you're using an ax stock youment it handles everything for you so you're in great shape but if not you need to make sure that using file coordination if you register yourself as a file presenter with the file coordination API we will make sure that your document is not evict it out from under you which is a good thing and then next if you use file coordination to coordinate your i/o on those files we'll make sure that we schedule your wat your i/o conveniently after the entire file has been downloaded and that's documents in the cloud now there are a couple of technologies that we didn't have time to talk about but I do want to give an honorable mention too the first is asset catalogs faster and smaller than having loose assets in your bundle and they can also help you with things like wide gamut and right-to-left accessibility extremely important Koko puts really powerful accessibility technologies within arm's reach of your application and it's extremely important that you make sure that you learn to use voiceover in order to use all these accessible technologies and make sure that your app is doing the right thing you would never ship an app with a visibly broken user interface so don't ship an app that has a UI that's broken to accessibility sandboxing and also exbc services to different but somewhat related technologies and that they help you isolate code from the rest of the system and from other processes sandboxing is of course mandatory for the Mac App Store but it's appropriate for every app really and exbc services can help you separate out code into separate processes this is really great for things like say code that's handling untrusted data off the network or doing some kind of parsing work we all like to think that our code is perfect but you know we also wear seatbelts in our cars and we're very happy that it's there if something goes wrong so we have covered an absolute ton of content in a very short amount of time so I want to rewind and recap and make sure that we all remember what we just talked about and we started off by looking at creating a modern look with our modern view and window pipeline making sure you get great animation performance then we talked about drag and drop and event tracking making sure that you get the really cool drag flocking effect modern drag file promises then we covered container views like scroll view and table view and making sure that we localize them correctly then we walked into system appearances storyboards and also a couple of modern Mac features that really make the platform shine and really take advantage of it here's the permalink for our talk you should find related resources there including the download for our demo application as soon as it becomes available all of our related sessions are in the past I hope you were able to attend them if not then you should definitely check out the videos online and that's a wrap thank you for attending you you
Info
Channel: beBetterDev
Views: 708
Rating: undefined out of 5
Keywords: Apple, WWDC, Cocoa Apps, Modern, 2016
Id: 61-AN084GH0
Channel Id: undefined
Length: 44min 11sec (2651 seconds)
Published: Mon Sep 12 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.