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
Getting started with 3D Touch
Search
sonson
September 27, 2016
Programming
0
670
Getting started with 3D Touch
How to implement "touch and peek" function in iOS9.
sonson
September 27, 2016
Tweet
Share
More Decks by sonson
See All by sonson
計算グラフのJITコンパイラをLLVM on C++で作ろう
sonsongithub
2
540
LLVMでHalideみたいな計算グラフ+JITを作りたい
sonsongithub
0
1.3k
LLVM Tutorial 02 - わいわいswiftc
sonsongithub
1
370
LLVM Tutorial - わいわいswiftc
sonsongithub
0
290
How to make and publish a Swift playground book for iPad
sonsongithub
5
19k
Swiftで実装するHTML特殊文字の高速処理
sonsongithub
3
7.6k
First step of 3D touch
sonsongithub
0
580
SSLって必要ですか〜Let's Encryptを試してみよう
sonsongithub
3
520
Other Decks in Programming
See All in Programming
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.7k
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
C++でシェーダを書く
fadis
6
4.1k
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Outline View in SwiftUI
1024jp
1
320
CSC509 Lecture 09
javiergs
PRO
0
140
Ethereum_.pdf
nekomatu
0
460
みんなでプロポーザルを書いてみた
yuriko1211
0
260
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Gamification - CAS2011
davidbonilla
80
5k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Navigating Team Friction
lara
183
14k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Designing for Performance
lara
604
68k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Typedesign – Prime Four
hannesfritz
40
2.4k
Transcript
ZPVSOBNF"MMSJHIUTSFTFSWFE3FEJTUSJCVUJPOPSQVCMJDEJTQMBZOPUQFSNJUUFEXJUIPVUXSJUUFOQFSNJTTJPOGSPNZPVSOBNF *OUSPEVDFUPVDIBOEQFFL 1SPHSBNNJOH ू·ΕSwift͖ʂSwiftѪձ vol11 :VJDIJ:PTIJEB 3FTFBSDIFS %&/40*5-BCPSBUPSZ *OD (FUUJOHTUBSUFEXJUI%UPVDI
4FMGJOUSPEVDUJPO sonson • sonson_twit@Twitter • sonsongithub@github Portfolio • 2tch(̎ͪΌΜͶΔϒϥβ)ͳͲͳͲ ຊۀ
• ΫϧϚۀք • ը૾ೝࣝͱ͔ɼUIͱ͔৭ʑ͓ͬͯΓ·͢ ιʔεΛެ։ͯ͠Δͷ͋Γ·͢ IUUQHJUIVCDPNTPOTPOHJUIVC
SFEEJGU 0QFOTPVSDFQSPKFDU 1ԯਓҎ্ͷΞϝϦΧͷSNS API͋Γ Objective-CͷAPI Wrapper͋Γ • OAuth2ʹରԠͯ͠ͳ͍ • Swift͡Όͳ͍
Α͠ɼ͍ͬͪΐɼझຯʴษڧ͕ͯΒ࡞Δ͔ʂ MIT License
4XJGU GSPNUP ݁ • beta1͔Βॱʹશ෦ରԠͨ͠ɾɾɾͳͷͰۤ࿑͕ബΕ͍ͯΔͱ͍͏͔ҧ͍͕Θ͔Βͳ͍ ۤ࿑ͨ͠ͱ͜Ζ • SwiftͰ࡞ΒΕͨ֎෦ϥΠϒϥϦͷϝϯςφϯε • SwiftͰ࡞ΒΕͨ֎෦ϥΠϒϥϦͷϝϯςφϯε
• SwiftͰ࡞ΒΕͨ֎෦ϥΠϒϥϦͷϝϯςφϯε • ҙຯෆ໌ͳ༷มߋʢมͷܕͱ͔ʣ
5PVDIBOEQFFL *OUSPEVDF%UPVDI ༻ҙ • registerForPreviewing(with:sourceView:) • unregisterForPreviewing(withContext:) σϦήʔτ - UIViewControllerPreviewingDelegate
• previewingContext(_:viewControllerForLocation:) • previewingContext(_:commit:)
%UPVDI 1. registerForPreviewingͰ४උ͢Δ 2. Ϣʔβ͕ڧ͘ԡ͢ 3. previewingContext(_:viewControllerForLocation:)͕ݺΕΔ 4. ԡ͞ΕͨྖҬΛઃఆ͢Δ 5.
͜͜Ͱview controllerΛ࡞Γɼฦ͢ 6. ࠷ޙ·Ͱڧ͘ԡ͠ࠐΉ 7. previewingContext(_:commit:)͕ݺΕΔ 8. ͜͜Ͱ͖ͬ͞࡞ͬͨview controllerΛͲ͏͢Δ͔ܾΊΔ
QSFWJFXJOH$POUFYU @WJFX$POUSPMMFS'PS-PDBUJPO 1SFQBSFBWJFXDPOUSPMMFSGPSQFFLJOH ϝΠϯʹΔ͜ͱ • view controllerΛ࡞Δ • ԡ͞ΕͨॴͷใΛఆ͢Δ •
ॴΛcontextʹೖྗ͢Δ • view controllerͷαΠζΛܾఆ͢Δ
QSFWJFXJOH$POUFYU @WJFX$POUSPMMFS'PS-PDBUJPO $SFBUFWJFXDPOUSPMMFSBOEGFUDIDPOUFOUT func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint)
-> UIViewController? { // Create new view controller for peeking let controller = WebViewController(nibName: nil, bundle: nil) let locationInTextView = self.view.convert(location, to: textView) // get contents controller.url = getUrl(at: locationInTextView) return controller }
QSFWJFXJOH$POUFYU @DPNNJU )PXJTUIFWJFXDPOUSPMMFSTIPXO ϝΠϯʹΔ͜ͱ • ࠓද͍ࣔͯ͠Δview controllerΛͲ͏͢Δ͔ܾΊΔ UIViewControllerͷ͓࡞๏ͰΓ·͠ΐ͏ • modalʁ
• pushʁ • ಠࣗʁʢ͓͢͢Ί͠ͳ͍ʣ
QSFWJFXJOH$POUFYU @DPNNJU 1VTI1SFTFOUWJFXDPOUSPMMFS func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController)
{ // Modal let nav = UINavigationController(rootViewController: viewControllerToCommit) self.present(nav, animated: true, completion: nil) // Push navigationController?.pushViewController(viewControllerToCommit, animated: false) }
.FOV
)PXUPQSFQBSFNFOVJUFNT override var previewActionItems : [UIPreviewActionItem] { get { let
action1 = UIPreviewAction(title: “action1”, style: .default) { previewAction, viewController in print(title) } let action2 = UIPreviewAction(title: “delete”, style: .destructive) { previewAction, viewController in print(title) } return [action1, action2] } }
ۤ࿑͢Δͱ͜Ζʁ ॴͷ͋Δίϯςϯπͷऔಘ • CGRect • func contains(_ point: CGPoint) ->
Bool ͋ΔViewͷCGRectCGPointΛଞͷView͔Βݟͨͱ͖ɾɾɾɾ • UICoordinateSpaceϓτϩίϧΛ͏ • func convert(CGPoint, to: UICoordinateSpace) • func convert(CGPoint, from: UICoordinateSpace) • func convert(CGRect, to: UICoordinateSpace) • func convert(CGRect, from: UICoordinateSpace)
αϯϓϧ ιʔείʔυ • https://github.com/sonsongithub/UZTextView/tree/develop • Sample3DTouch project WWDC2016 • https://developer.apple.com/videos/play/wwdc2016/228/
·ͱΊ Swift3 • SwiftͰ࡞ΒΕͨ֎෦ϥΠϒϥϦͷϝϯςφϯε • SwiftͰ࡞ΒΕͨ֎෦ϥΠϒϥϦͷϝϯςφϯε • SwiftͰ࡞ΒΕͨ֎෦ϥΠϒϥϦͷϝϯςφϯε • SwiftͰ࡞ΒΕͨ֎෦ϥΠϒϥϦͷϝϯςφϯε
3D touch - Touch & Peek • ׂͱ؆୯ • ରԠ͢ΔσϦήʔτ؆୯ • λονͨ͠ॴʹରԠ͢ΔใΛఆ͢Δͷ͕େม