2023/08/19 ~ 2023/08/25 のもくもく日記
もくもく 前回までは
2023/08/12 ~ 2023/08/18 のもくもく日記 をご覧ください。
途中経過
その1
気のせいかもだけど、tests とnetwork data の説明が増えた気がする👀
その2
UIKit でカスタムビューを作ってみたのだけど、今のところこんな感じになった。
カスタムビュー内にあるUI の制約はupdateConstraints
に置いてみた
あとやるとしたら、storyboard 等のプレビュー表示用にIBDesignable
に準拠すれば良いかな🤔
import UIKit
internal final class Dom: UIStackView {
private lazy var viewLeft = {
let view = UIView()
view.backgroundColor = UIColor.blue
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
private lazy var viewRight = {
let view = UIStackView()
view.axis = .vertical
view.alignment = .fill
view.backgroundColor = UIColor.yellow
view.distribution = .fill
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
private lazy var viewRight1 = {
let view = UILabel()
view.backgroundColor = UIColor.orange
view.text = "right1"
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
private lazy var viewRight2 = {
let view = UILabel()
view.backgroundColor = UIColor.red
view.text = "right2"
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
required init(coder: NSCoder) {
super.init(coder: coder)
setup()
}
override func updateConstraints() {
NSLayoutConstraint.activate([
viewLeft.heightAnchor.constraint(equalToConstant: 48),
viewLeft.widthAnchor.constraint(equalToConstant: 48),
viewLeft.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 16),
viewLeft.centerYAnchor.constraint(equalTo: centerYAnchor),
viewRight.topAnchor.constraint(equalTo: topAnchor),
viewRight.leadingAnchor.constraint(equalTo: viewLeft.trailingAnchor, constant: 16),
viewRight.trailingAnchor.constraint(equalTo: trailingAnchor),
viewRight.bottomAnchor.constraint(equalTo: bottomAnchor),
viewRight1.topAnchor.constraint(equalTo: viewRight.topAnchor, constant: 8),
viewRight1.bottomAnchor.constraint(equalTo: viewRight2.topAnchor),
viewRight2.topAnchor.constraint(equalTo: viewRight1.bottomAnchor),
viewRight2.bottomAnchor.constraint(equalTo: viewRight.bottomAnchor, constant: 8),
])
super.updateConstraints()
}
private func setup() {
axis = .horizontal
alignment = .center
backgroundColor = UIColor.lightGray
distribution = .equalSpacing
viewRight.addArrangedSubview(viewRight1)
viewRight.addArrangedSubview(viewRight2)
addArrangedSubview(viewLeft)
addArrangedSubview(viewRight)
}
}
その3
久々にiOS の実装をしていたのだけど、Android と比較して、色々躓いた……。
- VC 間で遷移パラメータを渡す際にシリアライズをかけない
- VC の破棄イベントが取りづらい
- OS バージョン差分がさっぱり
今回の成果
- GitHub
- Nintendo Switch でトレーニングを進めた
- 本を読み進めた
※関連Tweet
- https://twitter.com/shion_engineer/status/1692706442216964578
- https://twitter.com/shion_engineer/status/1692711149022969866
- https://twitter.com/shion_engineer/status/1692776482878501300
- https://twitter.com/shion_engineer/status/1693066063779643698
- https://twitter.com/shion_engineer/status/1693151928879042583
- https://twitter.com/shion_engineer/status/1693820823625412683
- https://twitter.com/shion_engineer/status/1694187646887809130
- https://twitter.com/shion_engineer/status/1694675731094319336