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

macOSでもっとアプリを作ろう - iOSDC Japan 2018

malt03
August 31, 2018

macOSでもっとアプリを作ろう - iOSDC Japan 2018

malt03

August 31, 2018
Tweet

More Decks by malt03

Other Decks in Technology

Transcript

  1. ϝϞΞϓϦʹٻΊΔཁ݅ w ϚʔΫμ΢ϯͰॻ͚Δ w ϫʔΫεϖʔε͕࡞ΕΔ w ϑΥϧμͱͯ͠อଘ͞ΕΔ w J04Ͱ΋ฤूͰ͖Δ w

    w ϚʔΫμ΢ϯͰॻ͚Δ w ϫʔΫεϖʔε͕࡞ΕΔ w ϑΥϧμͱͯ͠อଘ͞ΕΔ w J04Ͱ΋ฤूͰ͖Δ w ωΠςΟϒͰ͋Δ
  2. w "QQ,JUΛར༻ͨ͠$PDPB"QQσεΫτοϓΞϓϦ w 8FC7JFX &MFDUSPO 'MBTI +BWBͳͲͷٕज़Ͱߏங͠ͳ͍ w )*(ΛकΔʗ"QQMF७ਖ਼ΞϓϦΛϦεϖΫτ͢Δ w

    8JOEPXTͷ6*Λج४ʹ͠ͳ͍ w υϥοάΞϯυυϩοϓͳͲػೳతʹ΋.BD04ͷ࢓૊Έʹै͏ w ಠࣗ6*ͰԚછ͗͢͠ͳ͍ w .BD04Β͍͠৭࢖͍ w .BD04Β͍͠ΞχϝʔγϣϯʗΠϯλϥΫγϣϯ w .BD04Β͍͠ݴޠදݱʢྫ͑͹ʮ΢Πϯυ΢ʯʮ؀ڥઃఆʜʯͳͲʣ w .BD04Β͍͠ϑΥϯτʢ4BO'SBODJTDP )FMWFUJDB/FVF -VDJEB(SBOEF  )JSBHJOP4BOT .FOMP .POBDPʜʣ w ඪ४తͳϝχϡʔόʔ͓ΑͼΩʔϘʔυγϣʔτΧοτ VTBHJNBSV͞Μʮ6*͕Τϩ͍.BD"QQूʯΑΓ NBDΒ͍͠6*ͱ͸
  3. ࣝผࢠ ܧঝݩ ֦ுࢠ QVCMJDQMBJOUFYU QVCMJDUFYU UYU QVCMJDTPVSDFDPEF QVCMJDQMBJOUFYU QVCMJDDTPVSDF QVCMJDTPVSDFDPEF

    D DPNBQQMFQBDLBHF QVCMJDEJSFDUPSZ DPNBQQMFBQQMJDBUJPO QVCMJDFYFDVUBCMF DPNBQQMFBQQMJDBUJPOCVOEMF DPNBQQMFQBDLBHF DPNBQQMFCVOEMF DPNBQQMFBQQMJDBUJPO BQQ
  4. %SBHBOE%SPQ func outlineView( _ outlineView: NSOutlineView, writeItems items: [Any], to

    pasteboard: NSPasteboard ) -> Bool { let nodes = items.compactMap { $0 as? NodeModel } let filePromiseProviders = nodes.map { NSFilePromiseProvider( fileType: kUTTypePlainText as String, delegate: $0 ) } pasteboard.writeObjects(filePromiseProviders) return true }
  5. %SBHBOE%SPQ extension NodeModel: NSFilePromiseProviderDelegate { func filePromiseProvider( _ filePromiseProvider: NSFilePromiseProvider,

    fileNameForType fileType: String ) -> String { return name } func filePromiseProvider( _ filePromiseProvider: NSFilePromiseProvider, writePromiseTo url: URL, completionHandler: @escaping (Error?) -> Void ) { do { try write(to: url) } catch { completionHandler(error) } completionHandler(nil) } }
  6. /40VUMJOF7JFX protocol NSOutlineViewDataSource { func outlineView( _ outlineView: NSOutlineView, numberOfChildrenOfItem

    item: Any? ) -> Int func outlineView( _ outlineView: NSOutlineView, child index: Int, ofItem item: Any? ) -> Any func outlineView( _ outlineView: NSOutlineView, isItemExpandable item: Any ) -> Bool }
  7. /40VUMJOF7JFX protocol NSOutlineViewDelegate { func outlineViewSelectionDidChange( _ notification: Notification )

    func outlineView( _ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any ) -> NSView? }
  8. /40VUMJOF7JFX 0VUMJOF7JFX಺%SBHBOE%SPQ༻ protocol NSOutlineViewDataSource { func outlineView( _ outlineView: NSOutlineView,

    validateDrop info: NSDraggingInfo, proposedItem item: Any?, proposedChildIndex index: Int ) -> NSDragOperation func outlineView( _ outlineView: NSOutlineView, acceptDrop info: NSDraggingInfo, item: Any?, childIndex index: Int ) -> Bool }
  9. /40VUMJOF7JFX ։͖ঢ়ଶอଘ outlineView.autosaveName = .init(“foobar”) outlineView.autosaveExpandedItems = true protocol NSOutlineViewDataSource

    { func outlineView( _ outlineView: NSOutlineView, itemForPersistentObject object: Any ) -> Any? func outlineView( _ outlineView: NSOutlineView, persistentObjectForItem item: Any? ) -> Any? }