Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
From Xcode plugin to Xcode extension
Search
Khoa Pham
November 02, 2018
Technology
0
290
From Xcode plugin to Xcode extension
My talk at Mobile Era conference 2018 in Oslo
Khoa Pham
November 02, 2018
Tweet
Share
More Decks by Khoa Pham
See All by Khoa Pham
Introduction to Swiftlane
onmyway133
0
120
Better AppStore rating
onmyway133
0
370
Pragmatic Machine Learning for mobile apps
onmyway133
0
300
Unit Testing in iOS
onmyway133
0
380
Getting started with Flutter
onmyway133
2
500
Collection Update
onmyway133
4
300
A Taste of MVVM + RxSwift
onmyway133
1
450
LLDB
onmyway133
0
280
Block
onmyway133
0
340
Other Decks in Technology
See All in Technology
GraphQLに入門してみた
chiroruxx
2
130
こんなに簡単!AWSマルチアカウント
takuya_terada
0
120
Castor - Symfony Live 2024 - Paris
lyrixx
1
120
中学生でもわかる深層学習
e869120
14
4.6k
SREsのためのSRE定着ガイド
netmarkjp
10
1.7k
エンジニア候補者向け資料2024.03.28.pdf
macloud
0
2.9k
Azureコストは水道代/The_47th_Tokyo_Jazug
aeonpeople
3
390
技術広報として2023年度に頑張ったこと / What we did well in FY2023 as a DevRel
pauli
5
490
統計的学習理論読み Chapter 1
kmatsui
4
1k
あらゆる商品を扱う商品データベースを再設計した話 / product db re-architecture
rince
8
3.9k
戦略的DDDを実践するための跳躍力 / OOC 2024
pictiny
6
4.3k
Code Smells @Voxxed Bucharest 24
victorrentea
2
270
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
319
20k
[RailsConf 2023] Rails as a piece of cake
palkan
21
3.8k
We Have a Design System, Now What?
morganepeng
42
6.7k
Designing on Purpose - Digital PM Summit 2013
jponch
109
6.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
242
20k
Happy Clients
brianwarren
91
6.3k
The Power of CSS Pseudo Elements
geoffreycrofte
58
4.9k
The Invisible Customer
myddelton
114
12k
What's in a price? How to price your products and services
michaelherold
236
11k
The Invisible Side of Design
smashingmag
293
49k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
19
1.9k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
Transcript
From Xcode plugin to Xcode extension
About Khoa Pham github.com/onmyway133 github.com/hyperoslo medium.com/@onmyway133
It takes 2 iOS developers to start complaining about Xcode
XcodeWay
Xcode plugin
Alcatraz
XVim
SCXcodeMiniMap
FuzzyAutocompletePlugin
ColorSense-for-Xcode
Techniques • Private frameworks • Objective C Runtime • LLDB
• Swizzling
class-dump • IDEKit • DVTKit • Xcode.app/Contents/SharedFrameworks/DVTKit.framework
None
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") } }
None
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 }
IDEWorkspaceWindowController self.IDEWorkspaceWindowControllerClass = objc_getClass("IDEWorkspaceWindowController"); NSArray *workspaceWindowControllers = [self.IDEWorkspaceWindowControllerClass valueForKey:@"workspaceWindowControllers"];
XcodeGhost
Xcode Source Editor extension • Modify contents • Modify current
text selection • Seperated process protocol XCSourceEditorCommand { func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Error?) -> Void) }
App Extension • Share • Photo Editing • Today •
Finder Sync • Custom Keyboard • File Provider • Document Provider
Resign codesign
XcodeColorSense extension ? • No Notification • No UI modification
Color literal ! #colorLiteral
XcodeWay extension ? • No NSTask • No NSWorkspace •
No swizzling
AppleScript !
None
• NSUserAppleScriptTask • NSAppleEventDescriptor • ProcessSerialNumber on myOpenFolder(myPath) tell application
"Finder" activate open myPath as POSIX file end tell end myOpenFolder
App Sandbox
Scripts Directory NSApplicationScriptsDirectory
macOS Mojave • WWDC 2018 - Your Apps and the
Future of macOS Security • NSAppleEventsUsageDescription
• https://github.com/onmyway133/XcodeWay • https://github.com/onmyway133/XcodeColorSense2 • https://github.com/theswiftdev/awesome-xcode-extensions
Thanks May your code continue to compile