This file contains 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
#!/bin/bash | |
# Prefer IPv4 over IPv6 - make apt-get faster | |
sudo sed -i "s/#precedence ::ffff:0:0\/96 100/precedence ::ffff:0:0\/96 100/" /etc/gai.conf | |
# Update Packages | |
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
# Nano Editor |
This file contains 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
/* | |
XCodeTemplateGenerator.swift | |
Created by Nathan Tannar | |
Usage: | |
Run `swift XCodeTemplateGenerator.swift $SOURCE_FOLDER` where SOURCE_FOLDER is the root directory of your | |
XCode projects source code. A TemplateInfo.plist will be generated in the SOURCE_FOLDER allowing you | |
to copy the folder to your XCodes project template folder. | |
*/ |
This file contains 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
// | |
// Reflectable.swift | |
// | |
// Created by Nathan Tannar on 2018-12-04. | |
// | |
import Foundation | |
// Add this protocol to your `struct` or `class` | |
protocol Reflectable { |
This file contains 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
// | |
// Switch.swift | |
// Re-Engineering UISwitch | |
// | |
// Created by Nathan Tannar on 15/12/18. | |
// Copyright © 2018 Nathan Tannar. All rights reserved. | |
// | |
import UIKit |
This file contains 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 Switch: UIControl { | |
var isOn: Bool | |
// Determines if the thumbLayer stretches on touchDown | |
var isStretchEnable: Bool | |
// Border of the trackLayer, this also determines the inset of the innerLayer | |
var borderWidth: CGFloat | |
This file contains 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 ViewModelController<ViewModelType: IViewModel>: UIViewController { | |
let viewModel: ViewModelType | |
required init(viewModel: ViewModelType) { | |
self.viewModel = viewModel | |
super.init(nibName: nil, bundle: nil) | |
} |
This file contains 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 | |
protocol IReusableView: AnyObject where Self: UIView { | |
func prepareForReuse() | |
} | |
class TableViewCell<ViewType: IReusableView>: UITableViewCell { | |
let wrappedView = ViewType() | |
This file contains 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 RowView<LeftViewType: UIView, RightViewType: UIView, AccessoryViewType: UIView>: View { | |
let leftView = LeftViewType() | |
let rightView = RightViewType() | |
let accessoryView = AccessoryViewType() | |
override func viewDidLoad() { | |
super.viewDidLoad() |
This file contains 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 TextFieldCell: RowView<UILabel, TextField, UIView> { | |
var label: UILabel { return leftView } | |
var textField: TextField { return rightView } | |
} | |
class TextViewCell: RowView<UILabel, InputTextView, UIView> { | |
var label: UILabel { return leftView } | |
var textView: InputTextView { return rightView } |
This file contains 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 Controller<RootViewType: IView>: UIViewController { | |
var rootView: RootViewType! { | |
return view as? RootViewType | |
} | |
// MARK: - View Life Cycle | |
OlderNewer