Add a fixed table header view
MODIFY
frontend/ios/DroidKaigi 2019.xcodeproj/project.pbxproj
frontend/ios/DroidKaigi 2019.xcodeproj/project.pbxproj
3672C2DD21F7392900ACB910 /* Kingfisher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3672C2DC21F7392900ACB910 /* Kingfisher.framework */; };
3672C2DF21F73A9400ACB910 /* SpeakerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3672C2DE21F73A9400ACB910 /* SpeakerCell.swift */; };
36D1FA2721F5CF6600ADBBDE /* StoryboardInstantiable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36D1FA2621F5CF6600ADBBDE /* StoryboardInstantiable.swift */; };
+ 439CE2B22206356700AC597A /* SessionTableHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 439CE2B12206356700AC597A /* SessionTableHeaderView.swift */; };
43DC80C12200A0F600A3F710 /* FavoriteRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DC80C02200A0F600A3F710 /* FavoriteRepository.swift */; };
43DC80C72201FC8100A3F710 /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DC80C62201FC8100A3F710 /* UIButton+Extension.swift */; };
5917BCA621FA19B8005BEAF2 /* SessionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5917BCA521FA19B8005BEAF2 /* SessionHeaderView.swift */; };
3672C2DC21F7392900ACB910 /* Kingfisher.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kingfisher.framework; path = Carthage/Build/iOS/Kingfisher.framework; sourceTree = "<group>"; };
3672C2DE21F73A9400ACB910 /* SpeakerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpeakerCell.swift; sourceTree = "<group>"; };
36D1FA2621F5CF6600ADBBDE /* StoryboardInstantiable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoryboardInstantiable.swift; sourceTree = "<group>"; };
+ 439CE2B12206356700AC597A /* SessionTableHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionTableHeaderView.swift; sourceTree = "<group>"; };
43DC80C02200A0F600A3F710 /* FavoriteRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteRepository.swift; sourceTree = "<group>"; };
43DC80C62201FC8100A3F710 /* UIButton+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = "<group>"; };
5917BCA521FA19B8005BEAF2 /* SessionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionHeaderView.swift; sourceTree = "<group>"; };
366B060621F751C400C912AD /* TagsLeftAlignedCollectionViewFlowLayout.swift */,
366B060821F756CB00C912AD /* TagsCollectionViewCell.swift */,
5917BCA521FA19B8005BEAF2 /* SessionHeaderView.swift */,
+ 439CE2B12206356700AC597A /* SessionTableHeaderView.swift */,
);
path = Session;
sourceTree = "<group>";
362D90FD21F5DBC2006962C8 /* StartViewController.swift in Sources */,
362546CB21FCD4E8005ADB0F /* SessionDetailSectionHeaderView.swift in Sources */,
360744F321FAF0CE003569D3 /* SessionDetailHeaderTableViewCell.swift in Sources */,
+ 439CE2B22206356700AC597A /* SessionTableHeaderView.swift in Sources */,
360744F521FAF13C003569D3 /* SessionDetailTableViewCell.swift in Sources */,
362D910421F5DC2D006962C8 /* SessionsViewModel.swift in Sources */,
360744F121FADF53003569D3 /* SessionDetailViewController.swift in Sources */,

ADD
frontend/ios/DroidKaigi 2019/Scenes/Session/SessionTableHeaderView.swift
+//
+// SessionTableHeaderView.swift
+// DroidKaigi 2019
+//
+// Created by woxtu on 2019/02/03.
+//
+
+import UIKit
+import RxCocoa
+import RxSwift
+import SnapKit
+
+class SessionTableHeaderView: UIView {
+
+ override init(frame: CGRect) {
+ super.init(frame: frame)
+ commonInit()
+ }
+
+ required init?(coder aDecoder: NSCoder) {
+ super.init(coder: aDecoder)
+ commonInit()
+ }
+
+ private func commonInit() {
+ setupSubviews()
+ }
+
+ private lazy var startDayLabel: UILabel = {
+ let label = UILabel()
+ label.numberOfLines = 1
+ label.font = UIFont.systemFont(ofSize: 20)
+ label.textColor = UIColor(hex: "95959c")
+ label.text = "2019.2.7"
+ return label
+ }()
+
+ private func setupSubviews() {
+ addSubview(startDayLabel)
+ startDayLabel.snp.makeConstraints {
+ $0.centerY.equalToSuperview()
+ $0.leading.equalToSuperview().inset(20)
+ }
+ }
+}

MODIFY
frontend/ios/DroidKaigi 2019/Scenes/Session/SessionsViewController.swift
frontend/ios/DroidKaigi 2019/Scenes/Session/SessionsViewController.swift
@@ -18,9 +18,14 @@ final class SessionsViewController: UIViewController {
init(viewModel: SessionsViewModel) {
self.viewModel = viewModel
super.init(nibName: nil, bundle: nil)
- view.addSubview(tableView)
+ [tableHeaderView, tableView].forEach(view.addSubview)
+ tableHeaderView.snp.makeConstraints {
+ $0.top.leading.trailing.equalToSuperview()
+ $0.height.equalTo(48)
+ }
tableView.snp.makeConstraints {
- $0.edges.equalToSuperview()
+ $0.top.equalTo(tableHeaderView.snp.bottom)
+ $0.leading.trailing.bottom.equalToSuperview()
}
}
required init?(coder aDecoder: NSCoder) { fatalError() }
@@ -41,6 +46,8 @@ final class SessionsViewController: UIViewController {
private let dataSource = SessionDataSource()
+ private lazy var tableHeaderView = SessionTableHeaderView()
+
private lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .plain)
tableView.backgroundColor = .white

Add a fixed table header view