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/Foundation.h> | |
@class ExampleFoo; | |
@class ExampleBar; | |
@interface Example : NSObject | |
// notice there is no public designated initializer, so consumers can't instantiate Example directly. | |
// They must instantiate a subclass. | |
+ (instancetype _Nonnull)new NS_UNAVAILABLE; | |
- (instancetype _Nonnull)init NS_UNAVAILABLE; |
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 "Example.h" // https://gist.github.com/hborders/e00d7ff965ca8f8df8f7e762a2269efb | |
#import "ExampleSwitcher.h" // https://gist.github.com/hborders/f378b4e0d0f1d74ff7c8149cb04c6268 | |
#import "ExampleFoo.h" // https://gist.github.com/hborders/094f05d932b3d7a1e389184ba525b0c3 | |
#import "ExampleBar.h" // https://gist.github.com/hborders/f1c231a89de11157adf46ee85880733a | |
static void printExample(Example * _Nonnull example) { | |
[example switchFoo:^(ExampleFoo * _Nonnull foo_) { | |
NSLog(@"Foo: %@, %@", foo_.f, foo_.g); | |
} | |
bar:^(ExampleBar * _Nonnull bar_) { |
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 "Example.h" // https://gist.github.com/hborders/e00d7ff965ca8f8df8f7e762a2269efb | |
#import "ExampleFoo.h" // https://gist.github.com/hborders/094f05d932b3d7a1e389184ba525b0c3 | |
#import "ExampleBar.h" // https://gist.github.com/hborders/f1c231a89de11157adf46ee85880733a | |
@interface Example () | |
- (instancetype _Nonnull)initPrivate NS_DESIGNATED_INITIALIZER; | |
@end | |
@interface ExampleFoo() | |
- (instancetype _Nonnull)initPrivate NS_UNAVAILABLE; |
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
enum Example { | |
case Foo(f: String, g: String) | |
case Bar(b: Int, c: Int) | |
} | |
func printExample(_ example: Example) { | |
switch example { | |
case .Foo(let f, let g): | |
print("Foo: \(f), \(g)") | |
case .Bar(let b, let c): |
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
#include <stdio.h> | |
typedef enum { | |
FooType, | |
BarType, | |
} Type; | |
typedef struct { | |
char *f; | |
char *g; |
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
#include <stdio.h> | |
typedef enum { | |
FooType, | |
BarType, | |
} Type; | |
typedef struct { | |
char *f; | |
char *g; |
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
enum Example { | |
case Foo(f: String, g: String) | |
case Bar(b: Int, c: Int) | |
} | |
func printExample(_ example: Example) { | |
switch example { | |
case .Foo(let f, let g): | |
print("Foo: \(f), \(g)") | |
case .Bar(let b, let c): |
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
TWFoundation.podspec # the podspec that our Twitch iOS App and the TWFoundationHost project below consume | |
TWFoundation | |
├── Podfile # Configures TWFoundationHost and TWFoundationHostTests | |
├── Podfile.lock | |
├── Pods | |
│ ├── ... # Pods stuff | |
├── TWFoundation | |
│ ├── NSArray+TWFoundation.h | |
│ ├── NSArray+TWFoundation.m | |
| ├── ... # More TWFoundation classes |
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
#define HJBAssertNotSame(expression1, expression2, ...) \ | |
XCTAssert((expression1) != (expression2), \ | |
__VA_ARGS__) | |
- (void)testCFMutableSetWithOpaquePointersCopiedToNSSetByAddingDoesNotKeepOpaquePointerBehavior | |
{ | |
NSString * _Nonnull string1 = [@"ab" stringByAppendingString:@"cd"]; | |
NSString * _Nonnull string2 = [@"a" stringByAppendingString:@"bcd"]; | |
TWAssertNotSame(string1, |
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
#!/bin/bash -euo pipefail | |
if [ ${#} -eq 0 ] | |
then | |
# read from STDIN | |
MAYBE_CFBUNDLEVERSION=$( cat ) | |
else | |
MAYBE_CFBUNDLEVERSION="${1}" | |
fi |