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
// | |
// CompareEquatableProperties.swift | |
// ListableUI | |
// | |
// Created by Kyle Van Essen on 7/28/22. | |
// | |
import Foundation | |
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
public func Synchronize(semaphore : AnyObject, @noescape block : Void throws -> Void) rethrows -> Void | |
{ | |
objc_sync_enter(semaphore) | |
defer { objc_sync_exit(semaphore) } | |
try block() | |
} | |
@warn_unused_result | |
public func Synchronize<Type>(semaphore : AnyObject, @noescape block : Void throws -> Type) rethrows -> Type |
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
// Make initialization + configuration of mutable classes (such as views) easier. | |
@warn_unused_result | |
public func Init<Type>(value : Type, @noescape block: (object: Type) throws -> Void) rethrows -> Type | |
{ | |
try block(object: value) | |
return value | |
} | |
func example() | |
{ |
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
NSManagedObjectContext *context = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType]; | |
// Crashes with an EXC_BAD_ACCESS at 0x10. | |
context.parentContext = 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
/** | |
Allows easier pushing and popping of clang warnings. | |
Example (Ignoring undeclared selectors): | |
SQClangDiagnosticPushIgnored(-Wundeclared-selector); | |
SEL undeclaredSelector = @selector(thisSelectorDoesNotExist:::); | |
SQClangDiagnosticPop; | |
*/ |
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
1) Make Foo.xcconfig, add to project. | |
2) Change Xcode Project's Configurations to be based on Foo.xcconfig. | |
3) Add Run Script build phase. | |
4) Make Run Script build phase modifiy Foo.xcconfig to be something like "MY_FLAGS = "-lBar -lBaz"", etc. | |
5) Change "Other Linker Flags" in Build Settings to be ${MY_FLAGS}. |
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
/** | |
Provides the ability to verify key paths at compile time. | |
If "keyPath" does not exist, a compile-time error will be generated. | |
Example: | |
// Verifies "isFinished" exists on "operation". | |
NSString *key = SQKeyPath(operation, isFinished); | |
// Verifies "isFinished" exists on self. |