Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
AltConf report - Hakata.swift #8
Search
はるふ
June 25, 2019
Programming
400
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
AltConf report - Hakata.swift #8
はるふ
June 25, 2019
More Decks by はるふ
See All by はるふ
SwiftのArrayは メモリで連続だよ!
ha1f
0
71
Other Decks in Programming
See All in Programming
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
300
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
1.9k
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
56
38k
初心者DevRelとして参加者だった私が、DevRel Talks!#2に登壇するまでにしてきたこと
sokohirai
0
360
自分的「カンファレンスの楽しみ方」
syumai
0
200
巨大モノリシックアプリ モダン化大作戦
ktcryomm
0
850
AIとGame Jamで、ゲームを完成させた話
takahirosaeki
0
120
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
3.9k
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
240
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.5k
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
2.4k
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
28
2.8k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
270
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
240
Tell your own story through comics
letsgokoyo
1
1.1k
Code Review Best Practice
trishagee
74
20k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
280
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
530
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Transcript
AltConf 2019 Ϩϙʔτ ୈ8ճ HAKATA.swift LINE Fukuoka Corporation Δ;(@_ha1f)
Δ;(@_ha1f) • iOS Developer @ LINE Fukuoka • WWDCམͪͨʢߦͬͨ͜ͱͳ͍ʣ •
͍·͕ࡾ
࠷ۙͷۀʹΧελϜελϯϓ • จࣈΛηοτͰ͖Δελϯϓ • ͪΖΜiOS෦ͷΈ • https://engineering.linecorp.com/ja/blog/product-story-01-custom-sticker/
Topic • AltConf@SanJoseʹࢀՃ • ӳޠͰొஃ͖ͯ͠·ͨ͠ʂ • αϯϊθશൠʹ͍ͭͯϨϙʔτ͠·͢ʂ
Agenda • αϯϊθͰͷੜ׆ʹ͍ͭͯ • AltConfʹ͍ͭͯ • ొஃʹ͍ͭͯ • ͓·͚
αϯϊθͰͷੜ׆ʹ͍ͭͯ
αϯϊθ • ӈԼͷͭ Apple Google Facebook • ΧϦϑΥϧχΞभʢւ ؛ʣ •
αϯϑϥϯγεί CaltrainͰ1࣌ؒ
ྑ͍ఔͷా-αϯϊθߦศ • ాۭߓͰΊͬͪΌຊਓiOSΤϯδχΞ • ඈߦػͰྡͷ੮͕͜͏Ί͍͞Μͩͬͨ
αϯϊθͬͯͲΜͳͱ͜ʁ • ాࣷ • Uber͕ͳ͍ͱੜ͖ΒΕͳ͍ • ຖշɺ͕ࠩ͠ڧ͍ ɹʢଟ໘Ͱۄম͖ম͚Δʣ Apple ParkͰࢠങͬͨ
αϯϊθͷؾԹ • னॵͯ͘ྋ͍͠ • ͳΜͱ࠷ߴؾԹ100ʂ
αϯϊθͷؾԹ • னॵͯ͘ྋ͍͠ • ͳΜͱ࠷ߴؾԹ100ʂ • ͱ͍͏ͷஊͰϗϯτઁࢯ38
https://amzn.to/2xa2eUF SIMΧʔυ • దʹAmazonͰങ͍ͬͯͬͨ • 10ؒLTE͍์ϓϥϯ2990ԁ
αεϕΠҿΈձ • ϕΠΤϦΞࡏॅͷຊਓͱͷަྲྀ • ຖ݄ͬͯΔΒ͍͠
৯ࣄ • ͏·͍ɺͰ͔͍ɺߴ͍ ʢϋϯόʔΨʔͰ1500ԁͱ͔ʣ • ଞࠃͷྉཧଟ͍
ϗςϧʹHomewood Suites by Hilton • WWDCظؒத͚ͩΫιߴ͍ ɹʢ1ധ2.5ສԁͩͬͨʣ • ձ͔ΒిंͰ30͙Β͍ ɹʢۙ͘ചʣ
ே৯͖
AltConfʹ͍ͭͯ
None
WWDC ߦ͖͍ͨʂ
Submit!
Not selected…
None
None
AltConfͱ • Alternative Apple Developer Conference • WWDCͱಉ͡ఔʢ༵ۚtry! Swiftʣ •
αϯϊθͷɺWWDCձͷۙ͘Ͱ։࠵
WWDC
WWDC AltConf
WWDC AltConf try!Swift
·͡ͰͱͳΓʂ
ࣸਅࡱΕΔ
Wi-Fi…… WWDC͕ ࠷େڧ
ࢀՃඅ༻ • ࢀՃඅ0ԁʢάοζͳ͠ʣ or 7000ԁʢάοζͳ͠ʣ ɹor 4ສԁʢάοζ͋Γʣ • WWDCͷࢀՃऀͱ͔༡ͼʹདྷΔʢ࣮࣭ೖνΣοΫͳ͠ʣ
AltConfͷ༰ᶃ • ॳWWDCͷύϒϦοΫϏϡʔΠϯά • ̎Ҏ͕߱ηογϣϯ
AltConfͷ༰ᶄ • 2 track + LABS + ग़ήʔϜ • 10ͷLT
or 45ͷsession • ࣗLT
ͳ͔ͥग़Δ͓ञ • ேே৯ʴίʔώʔ͕ͰΔ • ༦ํञ͕ग़Δ • શ෦ແྉ
ొஃʹ͍ͭͯ
AltConfͰͷొஃ༰(10) • A story of Mysterious Asian Strings • ຊޠ/λΠޠ/ؖࠃޠͷจࣈͷѻ͍ʹؔ͢ΔςΫχοΫ
• ӳޠऀશ֯֯ɺมͳͲͷ͕ࣝͳ͍ͷͰɺͦͷհ
AltConfͷCfP • CfPʹग़ͯ͠ɺબΜͰΒ͏ܗࣜ • ग़ͨ͠ͷ݄̑Լ०ʢకΊΓΪϦΪϦʣ
Yours is among those selected! • ϝʔϧ͕དྷͯɺإࣸਅͱ͔ͷఏग़ΛٻΊΒΕͨ
AltConfͷCfPͷબޙ • εΫϦʔϯͷॎԣൺͱ͔ڭ͑ͯ͘ΕΔ • ਐߦͷਓ͕ಡΉհจΛࣄલʹఏग़͢Δ • ࢿྉͷࣄલఏग़ͳͲͳ͠
ొஃલ • AltConfࣗମਓগͳΊʢWWDCͷϏσΦݟͯΔਓ͕ଟ͍ʣ
ొஃ
ొஃͷ݁Ռ • ࣭͕͋ͬͨͱΓ͋͑ͣͳΜͱ͔ͳͬͨʂ • ԠΒ͑ͨ
ӳޠྗʁ • ཹֶɾւ֎ࡏॅܦݧͳ͠ • େֶೖࢼͰษڧ ʴ ࣾձਓʹͳ͔ͬͯΒձࣾͰ • TOEIC 855ʢ1લ770ʣ
ͦͯ͠ɺࣄ݅ىͬͨ͜
ొஃޙ…… ༵ʹొஃͨ͠
༵ۚͷ • פؾ͕ͨ͠ • ࣮Ր༵͔Β͕௧͔ͬͨ • ొஃʹ͚ͯͷਫ਼ਆྗͰ͑ͯͨͷ͕Εͨ
༵ Mission1: ମԹͷ֬ೝ ମԹܭͳ͍ʁ ͳ͍Αʁମௐѱ͍ͷʁ ͬΆ͍ΜΑͶ ͡Ό͋ελοϑʹങ͍ʹߦ͔ ͤΔΑɻ܅͚࣋ͪͲ ͋Γ͕ͱ
100.8°F
100.8°F • ઁࢯ38.2 • શʹ
ϗϯτͬͱͬͱ͍ɻ Mission2: อݥձࣾి පӃߦ͖͍ͨ ʙʙʹߦ͍ͬͯͩ͘͞ ͓͚ ཱͯସ͑Δ͔Β͓ۚݱͰ Θͳ͍͍ͯ͘Α ఱ࠽
༵ͳͷͰEmergency͔͍͋ͯ͠ͳ͍ Regional Medical Center
όʔίʔυΛΊΒΕ·͢
ͷޙɺݕ߲ࠪҰཡΛΒ͍·͢ • Θ͔Γ͍͢
ϗϯτͬͱͬͱ͍ɻ Mission3: ҩऀͱͷձ ɻ௧͍ @L#P{$@#P{$:{P@# ͳΔ΄Ͳ $:#{}P@{%@}_P@#!_+%(#! @)_%@#:$$LP@#{$L#@{ શʹཧղͨ͠
ΊͬͪΌΉ͍ͣ ͚ͲͳΜͱ͔ཧղͰ͖Δ·Ͱ આ໌ͯ͘͠Εͨʂʂʂ
ణ
ༀہ·ͰUberɻ7000ԁ͙Β͍Ͱͨ͠ɻ ॲํᝦͱༀ ॲํᝦ ༀ
පӃ • ࣄલʹΊͬͪΌઆ໌ͯ͘͠ΕΔʢinformed consentʣ ɹɹɹɹ˞ཧղͰ͖Δ͔ผ • A4࢛ຕɺΊͬͪΌஸೡͳஅॻΒ͑ͨ • 4͙࣌ؒΒ͍Έͨ΄͏͕ྑ͍ •
ؼࠃޙʹපӃߦͬͨ
·ͱΊ
·͡ͰࢀՃͯ͠Α͔ͬͨʂ • ग़ͯ΄ΜͱʹߦͬͯΑ͔ͬͨ • ϦΞϧλΠϜͰηογϣϯΛݟΕΔɺٞͰ͖Δ ɹɹʢWWDCࢀՃऀͱʣ • ྔΛײ͡ΒΕΔʂʂ
͓͢͢Ί࣋ͪ • ࢠɺαϯάϥε • betaͷmacOS, iOSΛೖΕͯΑ͍ • SIMΧʔυɺ௺ΓɺମԹܭɺༀɺอݥ
On YouTube Vlog • ΞϝϦΧͰͪΐͬͱߘͨ͠ • https://www.youtube.com/channel/ UC20AZKltEpdZkKYalgBhLHA • νϟϯωϧొɺߴධՁΑΖ͘͠Ͷʂ
https://youtu.be/D7cqkOx3hsg Other videos… AltConfͷײΠϯλϏϡʔ
https://youtu.be/SllqSFylicY Other videos… lovee͞ΜWWDCΠϯλϏϡʔ
THANK YOU LINE FukuokaɹΔ;(@_ha1f) Follow @ha1f on Twitter! Follow Δ;'s
ΤϯδχΞ vlog on YouTube!
A story of Mysterious Asian Strings (for iOS) AltConf SanJose
2019 LINE Fukuoka Tomoki Yamaguchi a.k.a. @ha1f
Tomoki Yamaguchi @_ha1f • iOS Developer from Japan! • Working
for LINE Fukuoka (Communication application) • Call me “half”
Hello Asian World. উ֞ೞࣁਃ สวัสดีครับ ͜Μʹͪ 㟬
How do you work with asian characters? • Even Amazon,
Apple have problems ϑΟϧλʔ filter Ωϟϯηϧ Cancel
Full-width, Half-width • Most Japanese, Chinese, Korean characters are full-width
AB12 ̖̗̍̎ ͑ͼұ್ • Alphabets, numbers have both styles
Today’s purpose • Tell about some techniques for asian characters
• Knowing a little will help you!
Agenda • Text layout (current) • Character counting • Text
validation
Vertical Form • Japanese, Chinese, Korean can be represented with
vertical form • Supported by Kindle ॎ ॻ ͖ ͷ ߹ ӈ ͔ Β ࠨ ʹ ಡ Έ · ͢ ԣॻ͖ͷ߹ ࠨ͔Βӈʹ ಡΈ·͢ Vertical Scroll Horizontal Scroll
Thai language sometimes exceeds UILabel • CALayer.clipToBounds will cut them
• We should not set “clipToBounds” • Basically Thai language specific
Agenda • Text layout • Character counting • Text validation
Counting characters • There are many ways to count characters
e.g. UTF-8, grapheme cluster, unicode scalar, width, … • Apple’s default (String.count) is grapheme cluster
Counting alphabet characters is easy • Most counting methods return
the same value
Asian Strings are not so easy • Each method returns
a different length • “.count” is more likely to return what you expect! i.e. user-friendly (recommended)
Thai language counting How long is this String? ำำำำำำำำำำำำำำำำำำ
Thai language counting • We should also restrict with memory
size • Grapheme cluster counting returns 1
Agenda • Text layout • Character counting • Text validation
Can you find a bug? Suppose we want to prevent
from inputting text longer than 3 characters // Forbid text longer than 3 func textField( _ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String ) -> Bool { return (textField.text?.count ?? 0) < 3 }
Character conversion • One character can be a combination of
multiple characters • Even insert / delete don’t change the characters count • Works like replacing
We have to validate String after change • We have
to check characters limit after change func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { let currentText = textField.text ?? "" let newText = (currentText as NSString) .replacingCharacters(in: range, with: string) return newText.count <= 3 }
Even this has a bug! func textField(_ textField: UITextField, shouldChangeCharactersIn
range: NSRange, replacementString string: String) -> Bool { let currentText = textField.text ?? "" let newText = (currentText as NSString) .replacingCharacters(in: range, with: string) return newText.count <= 3 }
Even this has a bug! func textField(_ textField: UITextField, shouldChangeCharactersIn
range: NSRange, replacementString string: String) -> Bool { let currentText = textField.text ?? "" let newText = (currentText as NSString) .replacingCharacters(in: range, with: string) return newText.count <= 3 } Let’s check the value here
Result of “replacingCharacters” can be wrong • Input and Output
do not match • The result can be shortened after confirmation Don’t trust intermediate text Don’t prevent input during editing!! ͔͍ͭ͠Ό → ։ൃऀ
We have to validate String after change • We have
to limit characters after confirmation override func viewDidLoad() { super.viewDidLoad() textField.addTarget(self, action: #selector(handleChange(_:)), for: .editingDidEnd) } @objc func handleChange(_ textField: UITextField) { textField.text = textField.text.map { String($0.prefix(3)) } }
Conclusion 1. Be careful for character’s width and height 2.
Be careful for counting strategy 3. Don’t block input during editing
THANK YOU LINE FukuokaɹΔ;(@_ha1f) Follow @ha1f on Twitter!