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
let appDelegateClass: AnyClass? = NSClassFromString("TEST_TARGET_MODULE_NAME.TestAppDelegate") ?? AppDelegate.self | |
let classString = NSStringFromClass(appDelegateClass!) | |
let argv = UnsafeMutableRawPointer(CommandLine.unsafeArgv) | |
.bindMemory(to: UnsafeMutablePointer<Int8>.self, capacity: Int(CommandLine.argc)) | |
UIApplicationMain(CommandLine.argc, argv, nil, classString) |
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
class CoreGlobal { | |
fileprivate static let shared = CoreGlobal() | |
fileprivate let device: DeviceManager | |
private class Config { | |
var deviceManager: DeviceManager? | |
} | |
private static let config = Config() | |
@discardableResult |
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
class LoadingLabel: UILabel { | |
var timer: Timer? | |
let states = [".", "..", "..."] | |
var currentState = 0 | |
func start() { | |
stop(withText: "") | |
timer = Timer.scheduledTimer(timeInterval: 0.3, target: self, selector: #selector(update), userInfo: nil, repeats: true) | |
timer?.fire() |
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
# Adapted from https://github.com/realm/realm-cocoa/blob/master/scripts/strip-frameworks.sh | |
# This script strips all non-valid architectures from dynamic libraries in | |
# the application's `Frameworks` directory which is required for App Store submission. | |
# | |
# The following environment variables are required: | |
# | |
# BUILT_PRODUCTS_DIR | |
# FRAMEWORKS_FOLDER_PATH | |
# VALID_ARCHS |
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 | |
# Adapted from http://stackoverflow.com/questions/24039470/xcode-6-ios-creating-a-cocoa-touch-framework-architectures-issues/26691080#26691080 | |
# and https://gist.github.com/cromandini/1a9c4aeab27ca84f5d79 | |
# Create a new aggregate target. | |
# For the automatically generated scheme, change its build config to "release". | |
# Ensure this target's "product name" build setting matches the framework's. | |
# Add a run script with `source "${PROJECT_DIR}/path_to_this_script` |
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 TheClass { | |
class func swizzle(_ original: Selector, with swizzled: Selector, for klass: AnyClass) { | |
let originalMethod = class_getInstanceMethod(klass, original) | |
let swizzledMethod = class_getInstanceMethod(klass, swizzled) | |
method_exchangeImplementations(originalMethod, swizzledMethod) | |
} | |
func swizzle(_ original: Selector, with swizzled: Selector) { | |
let klass: AnyClass! = object_getClass(self) |
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 UIKit | |
protocol Decodable { | |
func decode() -> Void | |
} | |
struct Action { | |
let decodable: AnyDecodable | |
} |
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
'use strict'; | |
const HTTPS = require('https'); | |
const URL = require('url'); | |
const QueryString = require('querystring'); | |
module.exports = function() { | |
return { | |
postJSON: function(url, params) { | |
const data = JSON.stringify(params); |
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
function containsQuestion(message) { | |
return 1; | |
} | |
function containsYou(message) { | |
return 0; | |
} | |
function senderRelationshipType(message) { | |
return 2; |
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
func loadJobs() { | |
let sharedDefaults = NSUserDefaults(suiteName: "group.ca.sundeepgupta.job") | |
if let jobs = sharedDefaults?.arrayForKey("jobs") as? [[String: String]] { | |
self.jobs = jobs | |
} else { | |
sharedDefaults?.setObject([], forKey: "jobs") | |
} | |
self.tableView.reloadData() | |
} |