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
| class Dynamic<T> { | |
| typealias Listener = T -> Void | |
| var listener: Listener? | |
| func bind(listener: Listener?) { | |
| self.listener = listener | |
| } | |
| func bindAndFire(listener: Listener?) { | |
| self.listener = listener |
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
| // | |
| // ActionTrampoline.swift | |
| // Swift 3 | |
| // | |
| // Created by Jason Jobe on 3/17/16. | |
| // Copyright © 2016 WildThink. All rights reserved. | |
| // | |
| // https://gist.githubusercontent.com/wildthink/677308084ab364044c76/raw/f713efca9ec6ca9b56c4405bd82ae33b1db98ec7/ActionTrampoline.swift | |
| // | |
| // Kudos (again) to Mike Ash! |
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
| self.resultSearchController = ({ | |
| let controller = UISearchController(searchResultsController: nil) | |
| controller.searchResultsUpdater = self | |
| controller.dimsBackgroundDuringPresentation = false | |
| controller.hidesNavigationBarDuringPresentation = false | |
| controller.searchBar.barStyle = .Black | |
| controller.searchBar.sizeToFit() | |
| self.tableView.tableHeaderView = controller.searchBar | |
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
| APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}" | |
| # This script loops through the frameworks embedded in the application and | |
| # removes unused architectures. | |
| find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK | |
| do | |
| FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable) | |
| FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME" | |
| echo "Executable is $FRAMEWORK_EXECUTABLE_PATH" |
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
| How to add WhatsApp to UIActivityViewController? | |
| Drop the Whatsapp.swift file in your project. | |
| Initialize the controller as described in ViewController.swift |
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 UIKit | |
| let GfycatPOSTURL = "https://gifaffe.s3.amazonaws.com/" | |
| let GfycatPolicy = "eyAiZXhwaXJhdGlvbiI6ICIyMDIwLTEyLTAxVDEyOjAwOjAwLjAwMFoiLAogICAgICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICAgICAgeyJidWNrZXQiOiAiZ2lmYWZmZSJ9LAogICAgICAgICAgICBbInN0YXJ0cy13aXRoIiwgIiRrZXkiLCAiIl0sCiAgICAgICAgICAgIHsiYWNsIjogInByaXZhdGUifSwKCSAgICB7InN1Y2Nlc3NfYWN0aW9uX3N0YXR1cyI6ICIyMDAifSwKICAgICAgICAgICAgWyJzdGFydHMtd2l0aCIsICIkQ29udGVudC1UeXBlIiwgIiJdLAogICAgICAgICAgICBbImNvbnRlbnQtbGVuZ3RoLXJhbmdlIiwgMCwgNTI0Mjg4MDAwXQogICAgICAgICAgICBdCiAgICAgICAgICB9" | |
| let GfycatAWSAccessKeyId = "AKIAIT4VU4B7G2LQYKZQ" | |
| let GfycatSignature = "mk9t/U/wRN4/uU01mXfeTe2Kcoc=" | |
| let GfycatTranscodeURL = "http://upload.gfycat.com/transcode/" | |
| class GfycatHandler: NSObject { |
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 UIKit | |
| class ViewController: UIViewController { | |
| @IBOutlet weak var cardView: UIView! | |
| var popTip = AMPopTip() | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| } |
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 createGIF(with images: [UIImage], loopCount: Int = 0, frameDelay: Double, callback: (data: NSData?, error: NSError?) -> ()) { | |
| let fileProperties = [kCGImagePropertyGIFDictionary as String: [kCGImagePropertyGIFLoopCount as String: loopCount]] | |
| let frameProperties = [kCGImagePropertyGIFDictionary as String: [kCGImagePropertyGIFDelayTime as String: frameDelay]] | |
| let documentsDirectory = NSTemporaryDirectory() | |
| let url = NSURL(fileURLWithPath: documentsDirectory)?.URLByAppendingPathComponent("animated.gif") | |
| if let url = url { | |
| let destination = CGImageDestinationCreateWithURL(url, kUTTypeGIF, UInt(images.count), nil) | |
| CGImageDestinationSetProperties(destination, fileProperties) |
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 application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { | |
| // Override point for customization after application launch. | |
| application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound | UIUserNotificationType.Alert | | |
| UIUserNotificationType.Badge, categories: nil)) | |
| return true | |
| } |
NewerOlder