Created
September 13, 2017 21:59
-
-
Save eyeplum/efa6ab27cac930c4f5fe9f7328b32f00 to your computer and use it in GitHub Desktop.
cocoa-for-ios-dev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import TruffautSupport | |
let layerHosting = """ | |
/* Layer Backed View */ | |
view.wantsLayer = true | |
// this view is now a layer-backed view | |
// the layer hierarchy is considered private and | |
// should NEVER be modified (add or remove sublayers) | |
/* Layer Hosting View */ | |
view.layer = CALayer() | |
view.wantsLayer = true | |
// this view is now a layer-hosting view | |
// the layer can be modified as you want | |
// but the z-index for subviews may not | |
// be deterministic | |
""" | |
let examplePage = """ | |
let examplePage = /* source code string */ | |
Page(title: "Example", contents: [ | |
.sourceCode(.swift, examplePage) | |
]) | |
""" | |
let presentation = Presentation(pages: [ | |
// intro | |
Page(title: "Cocoa Development for iOS Developers", subtitle: "Beyond the Sandbox"), | |
Page(title: "The Darwin Platform", contents: [ | |
.text("NeXTSTEP -> Mac OS X (macOS) -> iOS -> watchOS/tvOS"), | |
.text("Carbon -> Cocoa -> Cocoa Touch"), | |
.text("C -> Objective-C/Swift"), | |
.text("Project Builder/Interface Builder -> Xcode"), | |
.indent([ | |
.sourceCode(.plainText, "*.xcodeproj/project.pbxproj"), | |
.sourceCode(.plainText, "*.nib") | |
]), | |
]), | |
Page(title: "Topics", contents: [ | |
.text("macOS SDK"), | |
.text("Cross-platform (Darwin)"), | |
.text("Human Interface Design"), | |
.text("Books"), | |
]), | |
// macOS SDK | |
Page(title: "macOS SDK", subtitle: "import Cocoa"), | |
Page(title: "AppKit", subtitle: "The Application Layer"), | |
Page(title: "NSView", contents: [ | |
.text("A Reversed Coordinates"), | |
.indent([ | |
.sourceCode(.swift, "CGPoint.zero // lower left corner"), | |
.sourceCode(.swift, "override var isFlipped: Bool { return true } // now it's the same as iOS"), | |
]), | |
.text("Layer is Optional (added in macOS 10.5)"), | |
.indent([ | |
.sourceCode(.swift, layerHosting), | |
]), | |
.text("Changing Background Color"), | |
.indent([ | |
.sourceCode(.swift, "override func draw(_ dirtyRect: NSRect) { ... }"), | |
.sourceCode(.swift, "view.layer?.backgroundColor = NSColor.red.cgColor"), | |
]), | |
]), | |
Page(title: "NSScrollView", contents: [ | |
.sourceCode(.swift, "scrollView: NSScrollView"), | |
.indent([ | |
.sourceCode(.swift, "contentView: NSClipView"), | |
.sourceCode(.swift, "documentView: NSView"), | |
]), | |
.text("Scrolling is achieved by changing documentView's bounds"), | |
.text("Starts from the lower left corner"), | |
.text("Elastic scrolling is added in macOS 10.9"), | |
]), | |
Page(title: "NSTableView/NSCollectionView", contents: [ | |
.text("NSTableView"), | |
.indent([ | |
.text("2 dimension list (row and column)"), | |
.text("NSOutlineView"), | |
.text("View-based API"), | |
.text("Legacy API: NSCell-based table view"), | |
]), | |
.text("NSCollectionView"), | |
.indent([ | |
.text("Before macOS 10.11, cell is not reused"), | |
.text("After that, basically the same as UICollectionView") | |
]), | |
]), | |
Page(title: "NSViewController", contents: [ | |
.text("Before macOS 10.10:"), | |
.indent([ | |
.text("No view lifecycle management"), | |
.text("Not part of the responder chain"), | |
]), | |
.text("After macOS 10.10:"), | |
.indent([ | |
.text("Basically the same as UIViewController") | |
]), | |
]), | |
Page(title: "NSWindow/NSWindowController", contents: [ | |
.text("An extra layer above view/view controllers comparing to iOS"), | |
.text("An application can have as many windows as needed"), | |
.text("Action sheets and alerts are presented as windows"), | |
.text("WindowServer") | |
]), | |
Page(title: "NSToolbar/NSTouchBar", contents: [ | |
.text("Unique to macOS, no equivalent on iOS"), | |
.text("Context-aware"), | |
]), | |
Page(title: "Main Menu", contents: [ | |
.text("Context-aware among applications"), | |
.text("Menu item's action is dynamically dispatched"), | |
.indent([ | |
.sourceCode(.swift, "FirstResponder.responds(to: menuItemAction)"), | |
]), | |
]), | |
Page(title: "Lower Levels", subtitle: "Media, Core Services and Core OS Layer"), | |
Page(title: "Same as iOS", contents: [ | |
.text("2D/3D Rendering"), | |
.indent([ | |
.sourceCode(.plainText, "CoreAnimation"), | |
.sourceCode(.plainText, "SpriteKit"), | |
.sourceCode(.plainText, "SceneKit"), | |
.sourceCode(.plainText, "Metal"), | |
]), | |
.text("Image"), | |
.indent([ | |
.sourceCode(.plainText, "CoreImage"), | |
.sourceCode(.plainText, "ImageIO"), | |
]), | |
.text("Text"), | |
.indent([ | |
.sourceCode(.plainText, "Cocoa Text System and TextKit(iOS)"), | |
.sourceCode(.plainText, "PDFKit"), | |
.sourceCode(.plainText, "CoreText"), | |
]), | |
.text("Audiovisual"), | |
.indent([ | |
.sourceCode(.plainText, "AVFoundation"), | |
.sourceCode(.plainText, "CoreAudio"), | |
.sourceCode(.plainText, "AudioToolbox"), | |
]), | |
.text("Web Content"), | |
.indent([ | |
.sourceCode(.plainText, "WebKit"), | |
.sourceCode(.plainText, "JavaScriptCore"), | |
]), | |
.text("Networking"), | |
.indent([ | |
.sourceCode(.plainText, "URL Loading System"), | |
.sourceCode(.plainText, "CFNetwork"), | |
.sourceCode(.plainText, "Bonjour & MultipeerConnectivity"), | |
]), | |
.text("Multi-threading"), | |
.indent([ | |
.sourceCode(.plainText, "Grand Central Dispatch"), | |
.sourceCode(.plainText, "pthread"), | |
]), | |
]), | |
Page(title: "Unique to macOS", contents: [ | |
.sourceCode(.plainText, "NSXPCService"), | |
.indent([ | |
.text("Apple's inter-process communication implementation"), | |
]), | |
.sourceCode(.plainText, "FSEventStream"), | |
.indent([ | |
.text("File system event monitoring"), | |
]), | |
.text("Sandbox and Codesigning"), | |
.indent([ | |
.text("Sandbox and codesigning for macOS apps are optional"), | |
.indent([ | |
.text("Only required if distributing through Mac App Store"), | |
]), | |
.text("Developer ID Signed Application"), | |
.indent([ | |
.text("An alternative way to distribute macOS apps"), | |
.sourceCode(.shell, "$ codesign -dvvvv /Applications/Sketch.app"), | |
]), | |
]), | |
]), | |
Page(title: "Pure macOS Fun", subtitle: "Kernel Extensions and Private Frameworks"), | |
Page(title: "Kernel Extensions and Kernel Panic", contents: [ | |
.sourceCode(.plainText, ".kext"), | |
.sourceCode(.plainText, "IOKit"), | |
.text("If a loaded .kext crashes, it will result in a kernel panic"), | |
]), | |
Page(title: "Private Frameworks", contents: [ | |
.sourceCode(.shell, "/System/Library/PrivateFrameworks/"), | |
.sourceCode(.shell, "class-dump"), | |
.text("Example: UXKit"), | |
]), | |
// Cross-platform | |
Page(title: "Cross-platform", subtitle: "macOS/iOS/watchOS/tvOS/bridgeOS*"), | |
Page(title: "Example: Project Kerrigan"), | |
Page(title: "Unit Test without Simulators", contents: [ | |
.text("Add a macOS binary target for non-UI iOS code"), | |
.text("Run unit tests for the macOS binary"), | |
.text("Endorsed by Xcode Engineers at WWDC17 Xcode Labs"), | |
]), | |
// HID | |
Page(title: "Human Interface Design", subtitle: "TL;DR: Just read the HIGs"), | |
Page(contents: [ | |
.image("App-icon.png"), | |
]), | |
Page(contents: [ | |
.image("App-icon-design.png"), | |
]), | |
Page(contents: [ | |
.image("RASPMac_landing.png"), | |
]), | |
Page(contents: [ | |
.image("RASPMac_accounts.png"), | |
]), | |
Page(contents: [ | |
.image("RASPMac_drag_n_drop.png"), | |
]), | |
Page(contents: [ | |
.image("HIG.png"), | |
]), | |
// Books | |
Page(title: "Books", subtitle: "📖"), | |
Page(contents: [ | |
.image("advanced-macosx.png"), | |
.text("A walkthrough of advanced Mac OS X APIs"), | |
]), | |
Page(contents: [ | |
.image("macosx-internals.png"), | |
.text("1680 Pages"), | |
]), | |
Page(title: "One more thing", subtitle: "About the slides..."), | |
Page(title: "Example", contents: [ | |
.sourceCode(.swift, examplePage) | |
]), | |
Page(contents: [ | |
.image("CocoaHeads-Auckland.png"), | |
.text("Thursday, 14 Sep, 6:00 PM") | |
]), | |
Page(title: "Thank you!", subtitle: "Yan Li"), | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment