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
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
140
Family mrubyの進捗
kishima
1
110
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
7
2.7k
自分的「カンファレンスの楽しみ方」
syumai
0
200
Seeing Through Serverless: Observability for AWS Lambda with ADOT and CloudWatch Application Signals
seike460
PRO
1
130
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
110
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
230
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
470
信頼性の目標を誰も求めてない
shubox
0
500
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
160
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
150
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
160
Featured
See All Featured
Prompt Engineering for Job Search
mfonobong
0
450
Utilizing Notion as your number one productivity tool
mfonobong
4
590
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
What's in a price? How to price your products and services
michaelherold
247
13k
Faster Mobile Websites
deanohume
310
32k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Google's AI Overviews - The New Search
badams
0
1.6k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
330
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Practical Orchestrator
shlominoach
191
12k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
560
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!