Skip to content

Instantly share code, notes, and snippets.


Tomáš Slíž tomassliz

View GitHub Profile
tomassliz / Objective-C tricks
Last active Dec 24, 2015
Better singleton shared instance creation with use of GCD in Objective-C.
View Objective-C tricks
+ (instancetype)sharedInstance {
static TSClass *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[self alloc] init];
return sharedInstance;
tomassliz /
Last active Jan 2, 2016
Terminal command for showing Objective-C implementation files sorted by number of lines.
find . -name "*.m" -exec wc -l "{}" \; | sort -n
tomassliz / viewController.m
Last active Aug 29, 2015
BOOL value behaviour with high optimization level
View viewController.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
BOOL isMember = NO; // here must be variable set to no, otherwise is initialized to thrash
for (NSIndexPath *ip in self.expandedCells) {
if ([ip isEqualToIndexPath:indexPath]) {
isMember = YES;
View gist:a4630898ccce52e97e2c
CompileSwift normal x86_64 /Users/deny/Desktop/ExampleApp/ExampleApp/ViewController.swift
cd /Users/deny/Desktop/ExampleApp
/Applications/ -frontend -c -primary-file /Users/deny/Desktop/ExampleApp/ExampleApp/ViewController.swift /Users/deny/Desktop/ExampleApp/ExampleApp/AppDelegate.swift -target x86_64-apple-ios8.3 -enable-objc-interop -sdk /Applications/ -I /Users/deny/Library/Developer/Xcode/DerivedData/ExampleApp-goerkbjmunjsnkcerylpquuuwibk/Build/Products/Debug-iphonesimulator -F /Users/deny/Library/Developer/Xcode/DerivedData/ExampleApp-goerkbjmunjsnkcerylpquuuwibk/Build/Products/Debug-iphonesimulator -g -module-cache-path /Users/deny/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/deny/Library/Developer/Xcode/DerivedData/ExampleApp-goerkbjmunjsnkcerylpquuuwibk/Build/Intermediat

Keybase proof

I hereby claim:

  • I am tomassliz on github.
  • I am tomassliz ( on keybase.
  • I have a public key ASCT7g3K-mjV0jwLfN60NxsyktG8AjbO9T3eE8egoBf9rQo

To claim this, I am signing this object:

tomassliz / TestFlightHelper.swift
Created Feb 8, 2019
Check if the app is installed from TestFlight
View TestFlightHelper.swift
// Should be working for free apps too
func isTestFlight() -> Bool {
guard let appStoreReceiptURL = Bundle.main.appStoreReceiptURL else {
return false
return appStoreReceiptURL.lastPathComponent == "sandboxReceipt"