SlideShare a Scribd company logo
Swift オープンソース
勉強会
山下 大輔
• 自己紹介 https://github.com/daisuke0131
• ビズリーチのiOSエンジニア
• https://github.com/daisuke0131/
ViewMonitor を作っています。星ください。PR
下さい。
What s ViewMonitor
開発初期段階でよくある風景
デザイナ
エンジニア
プロトタイプ レイアウト指示書
デザイン反映
比較
配布
テスター
(チームメンバ)
フィードバック
ポテトチップスについて
レイアウト指示書 実際の実装(テスト配布アプリ)
比較
60 60
8
こういう状況で問題点をみつけないといけない
14pt #000000
8
ポテトチップスはしお味よりものりしお味
を選ぶ傾向にあります。コンソメ味も捨て
がたいですがのりしお味が食べたい。
ポテトチップスについて
ポテトチップスはしお味よりものりしお味
を選ぶ傾向にあります。コンソメ味も捨て
がたいですがのりしお味が食べたい。
13pt #0000008
背景 #FFFFFF
import ViewMonitor
func application(application: UIApplication, didFinishLaunchingWithOptions
launchOptions: [NSObject: AnyObject]?) -> Bool {
ViewMonitor.start()
return true
}
・1line execution
->色々設定しないと使えないアプリはめんどい(引数たくさん渡すとか)
method swizzling
extension UIViewController{
class func monitor_methodSwizzling_didAppearWillDisappear() {
monitor_methodSwizzling_exchange(fromSelector: "viewDidAppear:", toSelector:
"monitor_methodSwizzling_viewDidAppear:")
}
private class func monitor_methodSwizzling_exchange(fromSelector fromSelector:
Selector, toSelector: Selector) {
let fromMethod = class_getInstanceMethod(UIViewController.self, fromSelector)
let toMethod = class_getInstanceMethod(UIViewController.self, toSelector)
method_exchangeImplementations(fromMethod, toMethod)
}
func monitor_methodSwizzling_viewDidAppear(animated: Bool) {
monitor_methodSwizzling_viewDidAppear(animated)
ViewMonitor.detectedViewDidAppear(self)
}
}
->viewの描画イベントをフックする必要がある。
view view
観測対象のviewをマークングしてタップを検出したい。
x:100
y:100
view view
観測対象のviewをマークングしてタップを検出したい。
x:100
y:100
->アプリのkeyWindowから再帰的に子のviewを取得
->UIbuttonを配置して対象のviewにaddSubview
->UIButton自体に重ねたviewのオブジェクトを所有させる
ボタン押せなくなる問題
view
userInteractionEnabled = false
に設定されているとその上のview
のタップが取得できない。
ボタン押せなくなる問題
view
userInteractionEnabled = false
に設定されているとその上のview
のタップが取得できない。
->一旦userInteractionEnabledをtrueに設定しなおして
オブジェクトの参照を保持する。機能リセット時に元の状態に
戻す。
いけてないところ
->cocoaPodsでstoryboardの利用がうまくいかずコードで無理くり
画面実装。
->実際に目に見えないviewもたくさん存在しているので対象のview Object
を絞った。
やったら面白そうだなと思っていること
->injectionとreplace(挿入と置き換え)
->UILabelを実行時に動的に書き換えたり、新しいviewを挿入するなどして
 簡易的にレイアウトをいじれるようにしたら面白そう。
Swift(iOS) Java(Android)  Ruby(Rails)
のオープンソース勉強会を
やる予定

More Related Content

PDF
Let's Start Swift Open Source Activity.
PDF
View Monitoring Tips
PDF
20160529 Pepper SDK for Android Studio
PPTX
Pepper sdk for android studio with mac
PDF
20160529 30 android-workshop_upload
PDF
ABC2011w_テスト部
PDF
JUCEハンズオン@Ableton and Max Community Japan #009
PDF
JUCEではじめるBLOCKS開発_TOKYO BLOCKS HACKATHON 2018
Let's Start Swift Open Source Activity.
View Monitoring Tips
20160529 Pepper SDK for Android Studio
Pepper sdk for android studio with mac
20160529 30 android-workshop_upload
ABC2011w_テスト部
JUCEハンズオン@Ableton and Max Community Japan #009
JUCEではじめるBLOCKS開発_TOKYO BLOCKS HACKATHON 2018

What's hot (6)

PDF
JUCEではじめるVST/AUプラグイン開発@NoMaps2017
PPT
Camera API 3.0を触ってみた
PDF
Screenshots Test spoon + espresso
PDF
Ninja Testing at Toteka03
PDF
About GROOVE
PPTX
jsおじさん#5 ペッパーとjavascript
JUCEではじめるVST/AUプラグイン開発@NoMaps2017
Camera API 3.0を触ってみた
Screenshots Test spoon + espresso
Ninja Testing at Toteka03
About GROOVE
jsおじさん#5 ペッパーとjavascript
Ad

More from Daisuke Yamashita (16)

PDF
potatotips_77.pdf
PDF
State management for ios development
PDF
Static analysis for go lang
PDF
Convert the notification feature to the notification microservice
PDF
歯磨き.go #2
PDF
歯磨き.go Go言語の静的解析とコード生成勉強会
PDF
ライブラリを作って5年たったので振り返る
PDF
Tensorflow
PDF
Introduction of ios-chart in oss-labs#3
PDF
About SnapKit - Open source lab -
PDF
バグのことは嫌いになってもXcodeのことは嫌いにならないでください。
PDF
Unity Introduction from 2D shooting game.
PDF
OpenCV on mobile
PDF
Introduction of Swift from Machine Learning
PDF
Introduction of Swift from Game Development
PDF
How to measure UIView position on Native App
potatotips_77.pdf
State management for ios development
Static analysis for go lang
Convert the notification feature to the notification microservice
歯磨き.go #2
歯磨き.go Go言語の静的解析とコード生成勉強会
ライブラリを作って5年たったので振り返る
Tensorflow
Introduction of ios-chart in oss-labs#3
About SnapKit - Open source lab -
バグのことは嫌いになってもXcodeのことは嫌いにならないでください。
Unity Introduction from 2D shooting game.
OpenCV on mobile
Introduction of Swift from Machine Learning
Introduction of Swift from Game Development
How to measure UIView position on Native App
Ad

Swift open source library - ViewMonitor -