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
コードでUI構築してみた
Search
tiking
October 02, 2020
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
コードでUI構築してみた
以前LTで登壇した内容です
tiking
October 02, 2020
Transcript
23 slides
コードでUI構築してみた 2020/07/18 Zli × DMM合同
Readme name : 舘佳紀 colleage : 会津大学学部3年 さーくる : Zli所属です
Handlename : チキング 好きな言語 swift twitter @tikin0716 gitHub tiking76
背景 先日参加したハッカソンにて初めて体験して めっちゃええやんってなったので、個人でも やってみました。
あと… ・メルカリさんのこの記事をみて来てるぞ!!と思ったので… https://tech.mercari.com/entry/2019/12/13/155700 ・SwiftUIを用いてのXcode Previewによってデバックが手軽になったため。
今回やったこと storyboardやxibを使わずに、アプリを作った。
まずその前に… コードでUIを作るって実際どうなん?
メリット ・コードレビューがカンタン、差分がわかりやすい ・プルリクエスト、マージしようとしたときにコンフリクト(競合)が起きにくい ・パーツやUIViewControllerの再利用、継承がカンタン ・実装がコードに集約される(読みやすい)
storyboardのXML
デメリット ・iOSアプリ開発の入門はStoryboard前提のものが大半のため、学習コストがかかる ・レイアウトの確認に時間がかかる ・iOSエンジニア以外がレイアウトを確認したり、微調整するのに困難がある
どうやって作るん? ・コードでパーツを作っていきます。初回するコードの書き方→Initialization Closure ・自分の場合は、navigationControllerとか、rootViewの設定は、 SceneDelegate.swiftに書いてました ・layoutとかは、以下の画像のように実装していました。
SceneDeligateのコード
Layoutのコード Extention.swift
ラベルをつくりたい CustomInputAccessoryView.swif
ボタンをつくりたい CustomInputAccessoryView.swif, RegistrationController.swift
xibみたいなことしたい
None
letとlazyを使う時の注意 letでプロパティを定義した際には、viewDidloadで定義していないとselfが使えずエラー がでます。 button.addTarget(self, action: #selector(showNewMessage), for: .touchUpInside) この時にbuttonをlazyで定義してあげると、アクセス時に初期化されるのでselfが使え るようになります。
今回は、confighogehogeっていう関数で定義しているので使えている感じです。
画面遷移したい Loginページからメイン画面に遷移する
DEMO
参考資料 https://qiita.com/gaku2n/items/fa095276ab2d75cc8797
リポジトリー https://github.com/tiking76/chatapp
やってみておもったこと ・思いのほか自由なことができる反面、改めてIB(Interface Builder)の恩恵が あることを感 じることができました。 ・自分自身UIkitの知識が不足していたので、良い勉強になりました。
ここまで ありがとうございました
More Decks by tiking
See All by tiking
デザインシステムっていいな
tiking76
0
340
GraphQL 入門
tiking76
0
1.6k
みんなTCAって 知ってる?ver2.0
tiking76
1
390
みんなTCAって知ってる?
tiking76
0
1.1k
最近きてるかもって思ってるデザイン
tiking76
0
310
Swiftのちょっとうれしい構文
tiking76
0
160
p1assさんを作ろうと試みました
tiking76
0
180
PRのときに使われがちな略語のやつ
tiking76
0
160
swiftでもグラフ書いてみたくない??
tiking76
0
300
Other Decks in Programming
See All in Programming
Skills Are the New npm [AAIF Bengaluru, Nov 2026]
shivamsaraswat
0
140
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
240
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
860
自宅サーバはどこまで再現できるのか - Proxmox VE上のVM環境をIaCとバックアップで戻してみた
youto
0
450
ビジネスロジックを堅牢に~Scala 3のドメインプリミティブ~
j5ik2o
0
240
例外からRich Errorsまで Kotlinエラーハンドリングの進化を読み解く
shiita0903
0
250
Lean で手続き的プログラム の証明が書けるようになった
inoueasei
11
5.6k
R言語プログラミング
profjoesuzuki
0
130
エージェントの管理もエージェントに – herdr-core と自作バックログで作る司令塔 –
nearme_tech
PRO
2
170
The Cost of the DOM
ypresto
3
1.3k
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
1.3k
protojson における文字化けの扱い
kazuki1023
0
470
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Discover your Explorer Soul
emna__ayadi
2
1.4k
Skip the Path - Find Your Career Trail
mkilby
1
310
Fireside Chat
paigeccino
43
4.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
The Invisible Side of Design
smashingmag
301
52k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
1
320
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
4 Signs Your Business is Dying
shpigford
187
23k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
380
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Ruling the World: When Life Gets Gamed
codingconduct
0
450