Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Promotion activities for Mac OS X Development

nakajijapan
August 30, 2015
1.6k

Promotion activities for Mac OS X Development

Pepabo Tech Conference #3
~ YAPC::Asia PEPABO 2015 ~

nakajijapan

August 30, 2015
Tweet

Transcript

  1. Talk about • Welcome to Cocoa Programming • Features •

    commonly used features • originally used features • distributing • installer
  2. As OS X Developer • One year… • I released

    OS X Application, which is only Teiten. • I have read a book, Cocoa Programming for OS X.
  3. Teiten Teiten is an app that fixed-point observation a lot

    earnestly yourself by using a PC camera.
  4. Teiten Teiten is an app that fixed-point observation a lot

    earnestly yourself by using a PC camera. http://teiten.nakajijapan.net/
  5. Technology • Camera Control • AVFoundation • Generating Movie •

    CoreVideo, CoreMedia • Drag and Drop • App Kit • NSTableView
  6. NextSTEP • Object-oriented, multitasking operating system based on UNIX •

    NeXT Computer 1980 - 1990s • The source and base of Mac OS X and iOS and WatchOS
  7. NextSTEP • Object-oriented, multitasking operating system based on UNIX •

    NeXT Computer 1980 - 1990s • The source and base of Mac OS X and iOS and WatchOS • a Unix-based operating system • a powerful window server • an elegant set of libraries and tools • NeXTSTEP also innovated a large number of other GUI • -> OPENSTEP Three features:
  8. Cocoa • is Apple's native object-oriented application programming interface (API)

    for the OS X operating system. • consists of • Foundation • basic classes • Appkit • UI components • Core Data • other • Cocoa Touch
  9. Cocoa.h /* Cocoa.h Cocoa Framework Copyright (c) 2000-2015, Apple Inc.

    All rights reserved. This file should be included by all Cocoa application source files for easy building. Using this file is preferred over importing individual files because it will use a precompiled version. Tools with no UI and no AppKit dependencies may prefer to include just <Foundation/Foundation.h>. */ #import <Foundation/Foundation.h> #import <AppKit/AppKit.h> #import <CoreData/CoreData.h>
  10. Features • Notifications • UnitTest • Drawing Text With Attributes

    • User Defaults • Web Service • KVC KVO and Bindings • NSTimer • Localization and Bundles • Auto Layout • Storyboard • Concurrency • CoreAnimation
  11. Features • Notifications • UnitTest • Drawing Text With Attributes

    • User Defaults • Web Service • KVC KVO and Bindings • NSTimer • Localization and Bundles • Auto Layout • Storyboard • Concurrency • CoreAnimation I don’t talk features related to UIKit
  12. Features • Notifications • UnitTest • Drawing Text With Attributes

    • User Defaults • Web Service • KVC KVO and Bindings • NSTimer • Localization and Bundles • Auto Layout • Storyboard • Concurrency • CoreAnimation
  13. Cocoa Bindings • provides a means of keeping model and

    view values synchronized without you having to write a lot of “glue code.” • decrease the amount of code Mac Developer Library
  14. Cocoa Bindings • provides a means of keeping model and

    view values synchronized without you having to write a lot of “glue code.” • decrease the amount of code • KVC • KVO Mac Developer Library
  15. Features • Undo • Keyboard Event • Mouse Gestures •

    Drag and Drop • Alert • Mouse Event • NSView • NSViewController • NSArrayController • NSWindowController • NSDocument • NSDocumentController • NSTask
  16. Features • Undo • Keyboard Event • Mouse Gestures •

    Drag and Drop • Alert • Mouse Event • NSView • NSViewController • NSArrayController • NSWindowController • NSDocument • NSDocumentController • NSTask
  17. Features • Undo • Keyboard Event • Mouse Gestures •

    Drag and Drop • Alert • Mouse Event • NSView • NSViewController • NSArrayController • NSWindowController • NSDocument • NSDocumentController • NSTask
  18. Drag and Drop • A flashy copy and paste •

    Both the drag source and the drag destination must agree on the operation • Cross Application Drag and Drop
  19. Drag and Drop struct NSDragOperation : RawOptionSetType { init(_ rawValue:

    UInt) init(rawValue: UInt) static var None: NSDragOperation { get } static var Copy: NSDragOperation { get } static var Link: NSDragOperation { get } static var Generic: NSDragOperation { get } static var Private: NSDragOperation { get } static var Move: NSDragOperation { get } static var Delete: NSDragOperation { get } static var Every: NSDragOperation { get } @availability(OSX, introduced=10.0, deprecated=10.10) static var All_Obsolete: NSDragOperation { get } // Use NSDragOperationEvery @availability(OSX, introduced=10.0, deprecated=10.10) static var All: NSDragOperation { get } // Use NSDragOperationEvery }
  20. Drag and Drop • register dragged type • drag source

    • drag destination • mouse gesture • pasteboard DiceView.swift
  21. Features • Undo • Keyboard Event • Mouse Gestures •

    Drag and Drop • Alert • Mouse Event • NSView • NSViewController • NSArrayController • NSWindowController • NSDocument • NSDocumentController • NSTask
  22. Document Architecture • Duties • saving the model data to

    a file • loading the model data from a file • giving the views the data to display • taking user input from the views and updating the model Mac Developer Library
  23. Document Architecture • Constituting • NSDocument • create, presents, and

    store document data • NSDocumentController • Manages all of the document objects in the app • NSWindowController • display and manage a window Mac Developer Library
  24. Document Architecture • Duties • saving the model data to

    a file • loading the model data from a file • giving the views the data to display • taking user input from the views and updating the model
  25. Document Architecture • Duties • saving the model data to

    a file • loading the model data from a file • giving the views the data to display • taking user input from the views and updating the model Model
  26. NSDocumentController • manages all of the document objects in the

    app • creates only one in the app • has autosavingDelay property Mac Developer Library
  27. NSWindowController • manages a window, usually a window stored in

    a nib file. • manage a window by itself or as a role player in the Application Kit’s document-based architecture, which also includes NSDocument and NSDocumentController objects. Mac Developer Library
  28. NSViewController • A view controller manages a view, typically loaded

    from a nib file. • NSViewController • NSPageController • NSCollectionViewItem • NSSplitViewController • NSTabViewController
  29. NSViewController • Added OS X 10.5 • Prior to OS

    X 10.10 • View Controllers were not part of the responder chain. • View life cycle methods such as viewDidLoad(), viewWillAppear() • Cocoa did not provide any container view controllers • NSWindow’s contentViewController was not available • OS X 10.10 Yosemite Release Notes Cocoa Application Framework • Almost the same feature UIViewController for iOS
  30. NSViewController • Added OS X 10.5 • Prior to OS

    X 10.10 • View Controllers were not part of the responder chain. • View life cycle methods such as viewDidLoad(), viewWillAppear() • Cocoa did not provide any container view controllers • NSWindow’s contentViewController was not available • OS X 10.10 Yosemite Release Notes Cocoa Application Framework • Almost the same feature UIViewController for iOS • Storyboards • Container
  31. Distributing • Mac App Store • almost managed by Apple

    • can use App Services • iCloud Storage, In-App Purchase, Game Center, Push Notifications • Outside the Mac App Store • almost managed by Developer • no need to wait the review for Apple
  32. Distributing .BD"QQ4UPSF 0VUTJEF.BD"QQ4UPSF XJUI%FWFMPQFS*%  Ap Distribution Hosted by Apple

    Managed by developer (with Developer ID) Software Updates Hosted by Apple Managed by developer Worldwide Payment Processing Managed by Apple Managed by developer Volume Purchasing and Education Pricing Managed by Apple Managed by developer App Services (iCloud Storage, In-App Purchase, Game Center, Push Notifications) Available Not Available App Sandboxing Required Recommended
  33. Distributing .BD"QQ4UPSF 0VUTJEF.BD"QQ4UPSF XJUI%FWFMPQFS*%  Ap Distribution Hosted by Apple

    Managed by developer (with Developer ID) Software Updates Hosted by Apple Managed by developer Worldwide Payment Processing Managed by Apple Managed by developer Volume Purchasing and Education Pricing Managed by Apple Managed by developer App Services (iCloud Storage, In-App Purchase, Game Center, Push Notifications) Available Not Available App Sandboxing Required Recommended
  34. Distributing .BD"QQ4UPSF 0VUTJEF.BD"QQ4UPSF XJUI%FWFMPQFS*%  Ap Distribution Hosted by Apple

    Managed by developer (with Developer ID) Software Updates Hosted by Apple Managed by developer Worldwide Payment Processing Managed by Apple Managed by developer Volume Purchasing and Education Pricing Managed by Apple Managed by developer App Services (iCloud Storage, In-App Purchase, Game Center, Push Notifications) Available Not Available App Sandboxing Required Recommended
  35. App Sandboxing • is an access control technology 0UIFS 6TFS%BUB

    0UIFS 4ZTUFN3FTPVSDFT :PVSBQQ sandbox noaccess
  36. Installer • Mac App Store • unnecessary • itself installer

    • Outside the Mac App Store • DMG File
  37. Installer • DMG File • archive • decide a behavior

    in running disk image • convert to read only image ditto, hdid, and hdiutil Command AppleScript behavior
  38. Installer man Command ITTO(1) BSD General Commands Manual DITTO(1) NAME

    ditto -- copy directory hierarchies, create and extract archives SYNOPSIS ditto [-v] [-V] [-X] [<options>] src ... dst_directory ditto [-v] [-V] [<options>] src_file dst_file ditto -c [-z | -j | -k] [-v] [-V] [-X] [<options>] src dst_archive ditto -x [-z | -j | -k] [-v] [-V] [<options>] src_archive ... dst_directory ditto -h | --help DESCRIPTION In its first form, ditto copies one or more source files or directories to a destination directory. If the destination directory does not exist it will be created before the first source is copied. If the destination directory already exists then the source directories are merged with the previous contents of the destination. In its second form, ditto copies a file to the supplied dst_file pathname. The next two forms reflect ditto's ability to create and extract archives. These archives can be either CPIO format (preferred for unix content) or PKZip (for Windows compatibility). src_archive (and dst_archive) can be the single char- acter '-', causing ditto to read (write) archive data from stdin (or to stdout, respectively). ditto follows symbolic links provided as arguments but does not follow any links as it traverses the source or destination hierarchies. ditto overwrites existing files, symbolic links, and devices in the destination when these are copied from a source. The resulting files, links, and devices will have the same mode, access time, modification time, owner, and group as the source items from which they are copied. Pipes, sockets, and files with names beginning with .nfs or .afpDeleted will be ignored. ditto does not modify the mode, owner, group, extended attributes, or ACLs of existing directories in the destination. Files and symbolic links cannot overwrite directories or vice-versa. ditto can be used to "thin" Universal Mach-O binaries during a copy. ditto can also copy files selectively based on the contents of a BOM ("Bill of Materials") file. ditto preserves file hard links (but not directory hard links) present in the source directories and preserves setuid and setgid modes when run as the superuser. ditto will preserve resource forks and HFS meta-data information when copying unless instructed otherwise using --norsrc . Similarly, ditto will preserve extended attributes and Access Control Lists (ACLs) unless --noextattr or --noacl is passed. DITTONORSRC can be set in the environment as an alias to --norsrc --noextattr --noacl on the command line. OPTIONS -h Print full usage. -v Print a line of output to stderr for each source directory copied. -V Print a line of output to stderr for every file, symbolic link, and device copied. -X When copying one or more source directories, do not descend into directories that have a different device ID. -c Create an archive at the destination path. The default format is CPIO, unless -k is given. CPIO archives should be stored in files with names ending in .cpio. Compressed CPIO archives should be stored in files with names ending in .cpgz. -z Create compressed CPIO archives, using gzip(1) compression. -j Create compressed CPIO archives, using bzip2(1) compression. -x Extract the archives given as source arguments. The format is assumed to be CPIO, unless -k is given. Compressed CPIO is automatically handled. -k Create or extract from a PKZip archive instead of the default CPIO. PKZip archives should be stored in filenames ending in .zip. --keepParent When creating an archive, embed the parent directory name src in dst_archive. --arch arch Thin Universal binaries to the specified architecture. If multiple --arch options are specified then the resulting destination file will contain each of the specified architectures (if they are present in the source file). arch should be specified as "i386", "x86_64", etc. --bom bom Copy only files, links, devices, and directories that are present in the specified BOM. --rsrc Preserve resource forks and HFS meta-data. ditto will store this data in Carbon-compatible ._ AppleDouble files on filesystems that do not natively support resource forks. As of Mac OS X 10.4, --rsrc is default behavior. --norsrc Do not preserve resource forks and HFS meta-data. If both --norsrc and --rsrc are passed, whichever is passed last will take precedence. Both options override DITTONORSRC. Unless explicitly specified, --norsrc also implies --noextattr and --noacl to match the behavior of Mac OS X 10.4. --extattr Preserve extended attributes (requires --rsrc). As of Mac OS X 10.5, --extattr is the default.
  39. Conclusion • Welcome to Cocoa Programming • Features • commonly

    used features • originally used features • distributing • installer
  40. Conclusion • Welcome to Cocoa Programming • Features • commonly

    used features • originally used features • distributing • installer • I'm glad if you was interested even a little in Cocoa