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
// Many thanks to Code Different: http://stackoverflow.com/a/42749141/3440266 | |
import Foundation | |
struct ClassInfo : CustomStringConvertible, Equatable { | |
let classObject: AnyClass | |
let classNameFull: String | |
let className: String | |
init?(_ classObject: AnyClass?) { | |
guard classObject != nil else { return 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 Foundation | |
import PlaygroundSupport | |
/// A thread-safe array. | |
public class SynchronizedArray<Element> { | |
private let queue = DispatchQueue(label: "io.zamzam.ZamzamKit.SynchronizedArray", attributes: .concurrent) | |
private var array = [Element]() | |
public init() { } | |
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
extension UIVisualEffectView { | |
func fadeInEffect(_ style:UIBlurEffectStyle = .light, withDuration duration: TimeInterval = 1.0) { | |
if #available(iOS 10.0, *) { | |
let animator = UIViewPropertyAnimator(duration: duration, curve: .easeIn) { | |
self.effect = UIBlurEffect(style: style) | |
} | |
animator.startAnimation() | |
}else { |
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
/// An unescaped string from a potentially unsafe | |
/// source (such as user input) | |
struct UnsafeString { | |
var value: String | |
} | |
/// A string that either comes from a safe source | |
/// (e.g. a string literal in the source code) | |
/// or has been escaped. | |
struct SanitizedHTML { |
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
extension String { | |
func localizedWith(comment:String) -> String { | |
return NSLocalizedString(self, tableName: nil, bundle: Bundle.main, value: "", comment: comment) | |
} | |
} |
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 Foundation | |
fileprivate protocol Statelike { | |
var stateMachine: StateMachine { get } | |
func logIn() | |
func logOut() | |
} | |
extension Statelike { | |
func logIn() {} |
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
precedencegroup BooleanPrecedence { associativity: left } | |
infix operator ^^ : BooleanPrecedence | |
/** | |
Swift Logical XOR operator | |
``` | |
true ^^ true // false | |
true ^^ false // true | |
false ^^ true // true | |
false ^^ false // false | |
``` |
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
postfix operator ~ | |
protocol StaticallyAccessible { } | |
extension StaticallyAccessible { | |
static postfix func ~ (c: Self) -> Self.Type { | |
return type(of: c) | |
} | |
var 🌩: Self.Type { | |
return type(of: self) | |
} |
-
Find the Discord channel in which you would like to send commits and other updates
-
In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe!