This file contains hidden or 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 | |
internal class StoredExtensionPropertyData { | |
internal static var storedExtensionProperties = [ObjectIdentifier: StoredExtensionPropertyData]() | |
var properties = [String: Any]() | |
} | |
internal protocol ExtensionProperties: AnyObject { | |
func get<T>(key: String, owner: ExtensionProperties) -> T? | |
func set<T>(key: String, value: T?, owner: ExtensionProperties) |
This file contains hidden or 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
let checkConsentOfEvent = SEGBlockMiddleware { (context, next) in | |
if context.eventType == .track { | |
if (hasConsent(for: blah)) { | |
next(context) | |
} else { | |
return | |
} | |
} else { | |
next(context) | |
} |
This file contains hidden or 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
public struct AContext: ReferenceConvertible, Equatable, Hashable { | |
internal var _handle: SEGMutableContext | |
public typealias ReferenceType = SEGContext | |
public typealias _ObjectiveCType = SEGContext | |
public static func _getObjectiveCType() -> Any.Type { | |
return SEGContext.self | |
} | |
This file contains hidden or 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
public struct MessagesState: State, HasMessagesUnread, HasMessagesRead { | |
public var unreadCount: UInt = 0 | |
public var messages = [String]() | |
public var outbound = [String]() | |
public var sentCount: UInt = 0 | |
public var readCount: UInt = 0 | |
} | |
// supported state manipulation protocols. |
This file contains hidden or 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
protocol Proto1 { | |
var someInt: Int { get set } | |
} | |
protocol Proto2 { | |
var someInt2: Int { get set } | |
} | |
struct AStruct: Proto1, Proto2 { | |
var someInt: Int = 0 |
This file contains hidden or 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
public func exceptionFailure(_ message: String) { | |
let args: [CVarArg] = [] | |
if isInUnitTest() { | |
NSException.raise(NSExceptionName(rawValue: ELExceptionFailure), format: message, arguments: getVaList(args)) | |
} else { | |
#if DEBUG | |
NSException.raise(NSExceptionName(rawValue: ELExceptionFailure), format: message, arguments: getVaList(args)) | |
#endif | |
} | |
} |
This file contains hidden or 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
Time to decode 10,000 Person struct's from JSON: | |
Argo (Simple): 8.563 seconds | |
measureBlock { | |
let _ : [Person]? = decode(data) | |
} | |
Argo (Decomp'd): 3.344 | |
measureBlock { | |
let json: Argo.JSON = JSON.parse(data) |
This file contains hidden or 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
func test_measure_coconut() { | |
let json = THGCodable.JSON(bundleClass: TestingStuffTests.self, filename: "test.json") | |
measureBlock { | |
let array = json?.array | |
if let array = array { | |
let _: [Person] = array.map { object in | |
let jsonPerson = object as THGCodable.JSON | |
return try! Person.decode(jsonPerson) | |
} |
This file contains hidden or 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
// | |
// Decimal.swift | |
// Decimal | |
// | |
// Created by Brandon Sneed on 11/7/15. | |
// Copyright © 2015 theholygrail.io. All rights reserved. | |
// | |
import Foundation |
This file contains hidden or 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
func testSomeStuff() { | |
// trying to come up with shit to test. | |
var d: Decimal = 1234 | |
print(d) | |
d += 2 | |
print(d) |
NewerOlder