Skip to content

Instantly share code, notes, and snippets.

@MainasuK
Last active June 4, 2020 07:27
Show Gist options
  • Save MainasuK/6068ca66b58434115a0d9f2f1938d9d9 to your computer and use it in GitHub Desktop.
Save MainasuK/6068ca66b58434115a0d9f2f1938d9d9 to your computer and use it in GitHub Desktop.
Xcode Code Snippets
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
final class <#TableViewCell#>: UITableViewCell {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
_init()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
_init()
}
}
extension <#TableViewCell#> {
private func _init() {
<#code#>
}
}
import UIKit
final class <#ViewController#>: UIViewController {
}
extension <#ViewController#> {
override func viewDidLoad() {
super.viewDidLoad()
<#code#>
}
}
<#subview#>.translatesAutoresizingMaskIntoConstraints = false
addSubview(<#subview#>)
NSLayoutConstraint.activate([
<#subview#>.topAnchor.constraint(equalTo: topAnchor),
<#subview#>.leadingAnchor.constraint(equalTo: leadingAnchor),
trailingAnchor.constraint(equalTo: <#subview#>.trailingAnchor),
bottomAnchor.constraint(equalTo: <#subview#>.bottomAnchor),
])
deinit {
os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment