###Sketch trial non stop
Open hosts files:
$ open /private/etc/hosts
Edit the file adding:
127.0.0.1 backend.bohemiancoding.com
127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com
/* | |
In iOS 11, interactive view controller transitions no longer scrub by setting the layer speed to zero | |
and changing the timeOffset. As a result of this change, implicit animations that occur in places like | |
-viewWillAppear: (called during an interactive transition) no longer end up “caught in” the animation. | |
To get the same behavior for table view row deselection as before, you can either use UITableViewController | |
which implements this for you, or you can implement it manually by deselecting the row in an alongside | |
animation for the transition (set up in -viewWillAppear: using the transition coordinator). | |
Here is an example implementation which correctly handles some of the more subtle corner cases: |
// https://github.com/avito-tech | |
private class ObserverBox<T>: Hashable { | |
typealias Observer = T | |
private(set) weak var disposable: AnyObject? | |
private let objectIdentifier: ObjectIdentifier | |
var observers = [Observer]() | |
let hashValue: Int | |
enum Result<T, E> { | |
case value(T) | |
case error(E) | |
var value: T? { | |
switch self { | |
case .value(let value): | |
return value | |
case .error: |
//***************************************************************** | |
// MARK: - GCD based utility | |
//***************************************************************** | |
private let timerQueue = DispatchQueue(label: "com.timer.queue", | |
attributes: []) | |
final class Timer : NSObject { | |
private var dispatchTimer: DispatchSourceTimer? |
###Sketch trial non stop
Open hosts files:
$ open /private/etc/hosts
Edit the file adding:
127.0.0.1 backend.bohemiancoding.com
127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com
import UIKit | |
/// A validation rule for text input. | |
public enum TextValidationRule { | |
/// Any input is valid, including an empty string. | |
case noRestriction | |
/// The input must not be empty. | |
case nonEmpty | |
/// The enitre input must match a regular expression. A matching substring is not enough. | |
case regularExpression(NSRegularExpression) |
/* | |
Here’s a more general implementation of TableState that works for all types, provided your type conforms to the simple TableValuable protocol. | |
*/ | |
protocol TableValuable { | |
associatedtype TableItem | |
static func loadingValue() -> TableItem | |
static func failedValue() -> TableItem | |
func value() -> TableItem | |
} |
//: | |
//: UIView Animation Syntax Sugar | |
//: | |
//: Created by Andyy Hope on 18/08/2016. | |
//: Twitter: @andyyhope | |
//: Medium: Andyy Hope, https://medium.com/@AndyyHope | |
import UIKit | |
extension UIView { |
Written by Sheldon, please find me with #iOSBySheldon in Github, Youtube, Facebook, etc.
It is exaggerating to say we don't need to use for
loop or while
loop any more but we can take advantage of the Swift language built in functions to do loops. If I give you a question now.
Q: Assuming we have an optional nested array, please calculate the production of the values that are less than 5. let numbers: [[Int]?] = [[1, 3], nil, [2], [5, 10], nil, [4]]
, what is your best approach to do it?
And you know the solution that I am talking about is following Swift functions:
{% for type in types.based.JSONAutoRepresentable| %} | |
// sourcery:inline:auto:{{ type.name }}.JSONAutoRepresentable | |
init(_ json: JSON) { | |
{% for variable in type.storedVariables where variable|!annotated:"skip" %} | |
{% elif variable.type.based.JSONAutoRepresentable %} | |
{{ variable.name }} = {{ variable.unwrappedTypeName }}(json["{{ variable.name|camelToSnakeCase }}"]) | |
{% elif variable.isArray %} | |
{{ variable.name }} = json["{{ variable.name|camelToSnakeCase }}"].arrayValue.map({{ variable.typeName.array.elementTypeName.unwrappedTypeName }}.init) | |
{% elif variable.type.kind == "enum" %} | |
{{ variable.name }} = {{ variable.unwrappedTypeName }}(rawValue: json["{{ variable.name|camelToSnakeCase }}"].stringValue) ?? {{ variable.defaultValue }} |