git tag -d release01
git push origin :refs/tags/release01
/// Used to identify traits of the current UI Environment - especially useful for cross-platform code | |
public struct MNCUITraits: Withable { | |
/// Does *not* identify the device type, but the idiom of the layout to apply | |
/// This means that e.g. on iPad the layoutIdiom can be `.phone`, if run in Split Screen or SlideOver | |
public enum LayoutIdiom { | |
case phone(hasRoundCorners: Bool) | |
case pad(hasRoundCorners: Bool) | |
case mac | |
} |
import UIKit | |
@propertyWrapper | |
struct Printer<T> { | |
public var currentValue: T? | |
var wrappedValue: T? { | |
get { | |
print("Property wrapper value printed", currentValue) |
import Foundation | |
enum Either<A,B> { | |
case left(A) | |
case right(B) | |
} | |
// Works only using Swift 4.1 | |
extension Either: Codable where A: Codable, B: Codable { | |
enum CodingKeys: CodingKey { |
enum JSON: Decodable { | |
case bool(Bool) | |
case double(Double) | |
case string(String) | |
indirect case array([JSON]) | |
indirect case dictionary([String: JSON]) | |
init(from decoder: Decoder) throws { | |
if let container = try? decoder.container(keyedBy: JSONCodingKeys.self) { | |
self = JSON(from: container) |
// note that currentFirstResponder is obtained by this: | |
// | |
// static var currentFirstResponder: UIResponder? | |
// func findFirstResponder(sender: Any) { | |
// currentFirstResponder = self | |
// } | |
// | |
// class func currentFirstResponder() -> UIResponder? { | |
// currentFirstResponder = nil | |
// UIApplication.shared.sendAction(#selector(findFirstResponder), to: nil, from: nil, for: nil) |
import UIKit | |
@IBDesignable class CustomUITextField: UITextField { | |
@IBInspectable var cornerRadius: CGFloat = 0 { | |
didSet { | |
layer.cornerRadius = cornerRadius | |
} | |
} |
git tag -d release01
git push origin :refs/tags/release01
At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.
git commit --amend
This will open your $EDITOR
and let you change the message. Continue with your usual git push origin master
.
import UIKit | |
import XCPlayground | |
//For more info, visit: http://blog.human-friendly.com/swift-2-xcode-7-gm-at-least-generic-support-for-at-objc-protocols | |
func reloadTableView(tableView: UITableView, dataSource: GenericTVCDatasource<String>, data: [String]) -> UITableView { | |
dataSource.reload(data) | |
tableView.reloadData() | |
return tableView | |
} |