This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class InputToolbar: UIView { | |
| private let separator = UIView() | |
| private let button = UIButton(type: .system) | |
| private let textField = UITextField() | |
| private let sendButton = UIButton(type: .system) | |
| func initialize() { | |
| backgroundColor = .systemGreen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Because Label's size don't match, transition looks weird. | |
| import SwiftUI | |
| struct FloatingLabelTextField: View { | |
| @Namespace private var namespace | |
| let placeholder: String | |
| @Binding var text: String | |
| @State private var isTextFieldFirstResponder: Bool = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| // valid JSON format | |
| // 1. null | |
| // 2. String | |
| // 3. Number | |
| // 4. { "key": JSON, "key": JSON, ... } | |
| // 5. [JSON, JSON, ...] | |
| enum Status { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Channel { | |
| final int id; | |
| bool isStarred; | |
| bool isJoined; | |
| bool isEncrypted; | |
| Channel.fromJson(Map<String, dynamic> json) | |
| : id = json['channel_id'], | |
| isStarred = json['is_star'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SettingsViewController: UITableViewController {} | |
| func showSettings() { | |
| let vc = SettingsViewController() | |
| let nav = UINavigationController(rootViewController: vc) | |
| self.present(nav, animated: true) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @objc class SettingsViewController: UITableViewController { | |
| @objc convenience init() { | |
| self.init(categories: SettingCategory.allCases) | |
| } | |
| init(categories: [SettingCategory]) { | |
| super.init(nibName: nil, bundle: nil) | |
| } | |
| required init?(coder: NSCoder) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // designated init | |
| init() {} | |
| // designated init label | |
| init(label: Type) {} | |
| // convenience init | |
| convenience init() {} | |
| // convenience init label |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Model | |
| typealias ChannelID = Int | |
| struct ChannelGroup { | |
| var name: String | |
| var channels: [ChannelID] | |
| } | |
| // View's Model |