Mac OS X v10.7 Lion

  • Published on

  • View

  • Download


What's New In Mac OS X: Mac OS X v10.7 Lion

2/25/11 12:16 PM

Mac OS X v10.7 LionThis article summarizes the key technology changes and improvements that are available beginning with Mac OS X version 10.7 Lion. The information about these changes is organized into sections by technology area: Major Features describes overarching changes that span multiple technology areas or are otherwise of particular importance. Framework-Level Features describes changes to system frameworks. BSD And Kernel Features describes changes to the UNIX/POSIX portions of Mac OS X and to the Mac OS X kernel, device drivers, and kernel extensions. Application Features describes changes in the behavior of included applications such as Safari. Mac OS X Server describes changes to Mac OS X Server. Please file any bug reports about this seed or this documentation using

Major FeaturesThe following sections highlight features that span multiple technology areas or that are otherwise of particular importance in Mac OS X v10.7.

Application PersistenceIn Mac OS X v10.7, after a restart, the system automatically relaunches applications that were open when the user chose Log Out or Shut Down. In addition, the system automatically restores the state of applications that are relaunched after a restart. That is, windows that are open when an application terminates are reopened with the same size and location as before, their contents are scrolled to the same position, and their selections restored. When an application goes unused or has no open windows, Mac OS X may terminate it behind the scenes. When the user wants to use the application again, it usually relaunches instantly. Users who want to quit applications manually can still do so, but it is no longer necessary. For more information, see Mac OS X Application Programming Guide.

Automatic Document Saving and VersioningIn the applications that ship as part of Mac OS X v10.7, users no longer need to save documents explicitly or be concerned about losing unsaved changes. Document-based Cocoa applications can opt into this autosaving behavior with a simple override. With automatic saving enabled, the system automatically writes document data to disk as necessary so that data displayed in a document window is, in effect, always the same as the document data on disk. A file coordination mechanism maintains sequential access to files. (See Mac OS X File Coordination.) Applications that support automatic saving also support document version history browsing. To Page 1 of 12

What's New In Mac OS X: Mac OS X v10.7 Lion

2/25/11 12:16 PM

browse previous versions of a document, choose Browse All Versions from the pull-down menu at the right end of the menu bar. For more information, see Application Kit Framework Reference .

Mac OS X File CoordinationMac OS v10.7 includes a new mechanism, called file coordination, that allows your application to access files and directories in a way that is serialized with other processes accesses of the same files and directories so that inconsistencies due to overlapping reads and writes dont occur. File coordination is an important part of the implementation of the Mac OS v10.7 modernized document model that is described in Application Kit Release Notes (Lion) .

Full-Screen Application EnhancementsMac OS X v10.7 includes support for full-screen mode through methods in the NSApplication and NSWindow classes, and the NSWindowDelegate Protocol protocol. Full-screen support is off by default, but an application can turn it on with a simple method call. Turning on the support adds an Enter Full Screen menu item with associated action methods to the View menu if it exists. Otherwise, it adds it to the Window menu. There is also a new full-screen presentation option. NSWindow full-screen support includes a window style mask and notifications upon entering and exiting full-screen mode. It also provides programming interfaces for implementing custom animations that are shown when an application enters and exits full-screen mode. The NSWindowDelegate protocol allows the window delegate to control the full-screen content size and to provide a custom set of presentation options to be in effect while its window is the primary full-screen window. For more information, see Application Kit Framework Reference .

Overlay ScrollbarsMac OS X v10.7 introduces overlay scrollbars similar to those in iOS. Unless the user overrides scrollbar appearance using System Preferences, the following behavior occurs: If all of the users pointing devices support both horizontal and vertical touch scrolling, the scrollbars are hidden during normal use. They appear as an overlay on top of the windows content while the user is scrolling, and remain visible briefly to allow scrollbar dragging. If the user has at least one external pointing device that does not support scrolling, the scrollbar is displayed at all times and the usable space in the window is reduced, as in previous versions of Mac OS X. (These permanent scrollbars are referred to as legacy scrollbars.) If the user has no external pointing devices attached, the trackpad settings control the scrollbar behavior; if the user has disabled scrolling for the trackpad in System Preferences, legacy scrollbars are used.

Compatibility Note: There are three situations in which legacy scrollbars are used regardless of hardware or preferences: An NSScrollView with accessory views inside its scroll track Any subclass of NSScroller that does not declare itself to be overlay-scroller-compatible Any NSScroller that is not managed by an NSScrollView

Page 2 of 12

What's New In Mac OS X: Mac OS X v10.7 Lion

2/25/11 12:16 PM

In addition, the scrollbars no longer contain scroll arrows (in overlay mode or in legacy mode). Because these changes may affect your application layout, you should test your applications with both standard and scrolling pointing devices. For more information, see Application Kit Release Notes (Lion) .

PopoversIn Mac OS X v10.7, Application Kit provides support for popovers. A popover is a unit of content that is positioned relative to some other content on the screen. You use an anchor to express the relation between these two units of content. Each popover has an appearance that specifies its visual characteristics, as well as a behavior that determines which user interactions cause the popover to close. A transient popover is closed in response to most user interactions. A semitransient popover is closed when the user interacts with the window containing the popovers positioning view. Popovers with application-defined behavior are not usually closed on the developers behalf. AppKit automatically positions each popover relative to its positioning view and moves the popover whenever its positioning view moves. For additional granularity, you can specify a positioning rectangle within the positioning view. If you implement the appropriate delegate method, your applications popovers can be detached to become a separate window by dragging them. For more information, see Application Kit Framework Reference .

Sandboxing and Privilege SeparationMac OS X v10.7 provides built-in support for application sandboxing and privilege separation. Sandboxing allows the developer of a particular application, tool, or other binary to specify a list of things that it is expected to do during normal operation. The operating system then enforces that list. For example, a text editor might need to edit files on disk that have been opened by the user, but it probably does not need to open arbitrary files in other locations or communicate over a network. Privilege separation is another common technique for improving security. Privilege separation means breaking up a complex application, tool, or daemon into pieces that individually require fewer rights. Modern applications are becoming progressively more dependent on networking. Users view webpages from untrusted sources, download documents from untrusted sources, and obtain information via network connections to untrusted sources. The growing reliance on untrusted data represents an ever-growing attack vector for viruses and other malware. With traditional applications, if the application becomes compromised through a buffer overflow or other security hole, its attacker also gains the ability to do anything that the user can do. There are two common solutions to this problem: sandboxing and privilege separation. These can be used independently or together to improve security. For example, if the text editor mentioned above needs to update its help files, it might include a helper that has the right to download help files from the Internet, but only the right to write files inside the applications container. Because of the reduced privileges of the helper and the main application, any flaws in either part of the application that might otherwise be exploitable are ultimately of limited utility to the attacker Page 3 of 12

What's New In Mac OS X: Mac OS X v10.7 Lion

2/25/11 12:16 PM

because neither part of the application runs with the complete privileges and capabilities of the user. For more information about sandboxing and privilege separation, read Mac OS X Application Programming Guide. Then read Daemons and Services Programming Guide.

Framework-Level FeaturesThe following sections highlight changes to frameworks and technologies in Mac OS X v10.7.

AV FoundationThe AV Foundation framework, previously available in iOS, is now also part of Mac OS X. You use the AV Foundation framework to play and create time-based audiovisual media. It provides an Objective-C interface you use to work on a detailed level with time-based audiovisual data. For example, you can use it to examine, create, edit, or reencode media files. You can also get input streams from devices and manipulate video during realtime capture and playback. For more information, read AV Foundation Programming Guide and AV Foundation Framework Reference for Mac OS X .

Cocoa AutolayoutMac OS X v10.7 introduces a new layout system to Cocoa, reworking the springs and struts model. Instead of using autosizing masks, you define layout constraints that express your intent, such as these views line up head to tail, or this plus/minus button segmented control should move with this split view subview. This model provides the following benefits: Localization by just swapping strings, not adjusting layout in the majority of cases. Mirroring of UI for right-to-left languages, such as Arabic and Hebrew. Simpler expression of existing concepts in UIs. Better layering of responsibility between view and controller layers. Pixel-perfect layout at all scale factors with resolution independence. Future updates of Interface Builder may add built-in support for Autolayout. For more information, see Cocoa Autolayout Release Notes .

Core DataMac OS X v10.7 adds support for ordered relationships. It also introduces an incremental store. This incremental store suport allows you in principle to write a Core Data store for a relational database such as MySQL. Both of these features have been frequently requested over the years. For more information, see Core Data Framework Reference .

Font CollectionsMac OS X v10.7 now provides the NSFontCollection API. NSFontCollection is an Objective-C interface to all of the functionality in the CTFontCollection API (described in CTFontCollection Page 4 of 12

What's New In Mac OS X: Mac OS X v10.7 Lion

2/25/11 12:16 PM

Reference ), plus a few higher-level features to support font UIs. It is toll-free bridged to CTFontCollection.For more information, see Application Kit Framework Reference .

Icon Drag FlockingMac OS X v.10.7 introduces the notion of icon drag flocking. Drag flocking allows fine-grained control over icon dragging. The source application can change the image of the drag, as can the destination of the drag. When multiple items are dragged, they flock together into a stack. For more information, see Application Kit Framework Reference .

Index Set Range EnumerationMac OS X v10.7 adds support for enumerating ranges within an index set. NSIndexSet is an abstraction of a set of indexes. Developers often also view it as a set of noncontiguous ranges, which is a natural extension of this abstraction. As a result, developers often want to be able to enumerate the contents of an NSIndexSet object in terms of ranges, instead of individual indexes. Beginning in Mac OS X v10.7, NSIndexSet includes convenience methods to provide this enumeration functionality. For more information, see Foundation Framework Reference .

JSON SerializationIn Mac OS X 10.7, the Foundation framework adds a new class, NSJSONSerialization, to support conversion of JSON data ( into Foundation types and vice versa. For more information, see the NSJSONSerialization.h header file and Foundation Framework Reference .

Linguistic TaggingMac OS X v10.7 introduces a linguistic tagging class, NSLinguisticTagger, that lets you break down a sentence into its grammatical components, allowing the determination of nouns, verbs, adverbs, and so on. This tagging works fully for English. The API provides a method to find out what capabilities are currently available in other languages as well. For more information, see Foundation Framework Reference .

NSFileWrapper Now In FoundationIn Mac OS X v10.7, the NSFileWrapper class is in the Foundation framework instead of the AppKit framework. For more information, see Foundation Framework Reference and Application Kit Framework Reference .

OpenGL 3.2Mac OS X v10.7 now provides OpenGL 3.2 on hardware capable of supporting its feature set. Read OpenGL Programming Guide for Mac OS X to learn about selecting the OpenGL 3.2 Core profile.

Ordered Sets Support Page 5 of 12

What's New In Mac OS X: Mac OS X v10.7 Lion

2/25/11 12:16 PM

Mac OS X v10.7 now provides support for ordered sets. An NSOrderedSet object contains each element at most once, and the elements can be accessed by a compact integer index space, numbered 0 .. (N-1). It thus combines two of the most salient features of the NSSet and NSArray classes. The NSOrderedSet class similarly borrows a...


View more >