Skip to content

Instantly share code, notes, and snippets.

@yoxisem544
Last active April 18, 2019 16:16
Show Gist options
  • Save yoxisem544/e12e1a9dc4454c68c6c739588720fdf6 to your computer and use it in GitHub Desktop.
Save yoxisem544/e12e1a9dc4454c68c6c739588720fdf6 to your computer and use it in GitHub Desktop.
// UIViewController
import UIKit
final public class <#AnyViewController#>: UIViewController {
// MARK: - πŸ“Œ Constants
// MARK: - πŸ”Ά Properties
// MARK: - 🎨 Style
// MARK: - 🧩 Subviews
// MARK: - πŸ‘† Actions
// MARK: - πŸ”¨ Initialization
public init() {
super.init(nibName: nil, bundle: nil)
}
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - πŸ–Ό View Lifecycle
public override func viewDidLoad() {
super.viewDidLoad()
seutpUI()
}
public override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
// resize when frame has changed...
}
// MARK: - πŸ— UI
private func seutpUI() {
}
// MARK: - 🚌 Public Methods
// MARK: - πŸ”’ Private Methods
}
// MARK: - 🧢 Extensions
// UIView
import UIKit
final public class <#AnyView#>: UIView {
// MARK: - πŸ“Œ Constants
// MARK: - πŸ”Ά Properties
// MARK: - 🎨 Style
// MARK: - 🧩 Subviews
// MARK: - πŸ‘† Actions
// MARK: - πŸ”¨ Initialization
public convenience init() {
self.init(frame: .zero)
}
private override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - πŸ— UI
private func setupUI() {
}
// MARK: - 🚌 Public Methods
// MARK: - πŸ”’ Private Methods
}
// MARK: - 🧢 Extensions
// UICollectionViewCell
import UIKit
final public class <#AnyCell#>: UICollectionViewCell {
// MARK: - πŸ“Œ Constants
// MARK: - πŸ”Ά Properties
// MARK: - 🎨 Style
// MARK: - 🧩 Subviews
// MARK: - πŸ‘† Actions
// MARK: - πŸ”¨ Initialization
public override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - πŸ— UI
private func setupUI() {
}
// MARK: - 🚌 Public Methods
// MARK: - πŸ”’ Private Methods
}
// MARK: - 🧢 Extensions
// Static let CGFloat
static let <#Any#>: CGFloat = <#Value#>
// static let font
static let font = UIFont(name: "<#T##String#>", size: <#T##CGFloat#>)!
// static let text color
static let textColor = "#<#color#>".color
// configure
private func configure<#Something#>() {
}
// Setup ui
private func setupUI() {
}
// Extend self life
guard let `self` = self else { return }
// View can bind ViewModel
// ViewModel Type
// Decodable
public struct <#DecodableModel#>: Decodable {
enum CodingKeys: String, CodingKey {
<#Add some cases...#>
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
<#Decode your model...#>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment