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

From Xcode plugin to Xcode extension

Khoa Pham
November 02, 2018

From Xcode plugin to Xcode extension

My talk at Mobile Era conference 2018 in Oslo

Khoa Pham

November 02, 2018
Tweet

More Decks by Khoa Pham

Other Decks in Technology

Transcript

  1. DVTBezelAlertPanel class func swizzleMethods() { guard let originalClass = NSClassFromString("DVTBezelAlertPanel")

    as? NSObject.Type else { return } do { try originalClass.jr_swizzleMethod("initWithIcon:message:parentWindow:duration:", withMethod: "xmas_initWithIcon:message:parentWindow:duration:") } catch { Swift.print("Swizzling failed") } }
  2. DVTSourceTextView func listenNotification() { NSNotificationCenter.defaultCenter().addObserver( self, selector: #selector(handleSelectionChange(_:)), name: NSTextViewDidChangeSelectionNotification,

    object: nil) } func handleSelectionChange(note: NSNotification) { guard let DVTSourceTextView = NSClassFromString("DVTSourceTextView") as? NSObject.Type, object = note.object where object.isKindOfClass(DVTSourceTextView.self), let textView = object as? NSTextView else { return } self.textView = textView }
  3. Xcode Source Editor extension • Modify contents • Modify current

    text selection • Seperated process protocol XCSourceEditorCommand { func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Error?) -> Void) }
  4. App Extension • Share • Photo Editing • Today •

    Finder Sync • Custom Keyboard • File Provider • Document Provider
  5. macOS Mojave • WWDC 2018 - Your Apps and the

    Future of macOS Security • NSAppleEventsUsageDescription