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 | |
protocol SomeDelegateProtocol : class { | |
func firstFunc() -> String | |
func secondFunc() -> Bool | |
func thirdFunc() -> Self | |
} | |
class MyClass { | |
weak var delegate : SomeDelegateProtocol? |
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
# Get the Git branch | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
# Custom bash prompt | |
# | |
# Includes custom character for the prompt, path, and Git branch name. | |
# | |
# Source: kirsle.net/wizards/ps1.html |
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
// | |
// WatchSessionManager.swift | |
// WatchConnectivityDemo | |
// | |
// Created by Natasha Murashev on 9/3/15. | |
// Copyright © 2015 NatashaTheRobot. All rights reserved. | |
// | |
import WatchConnectivity |
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 | |
import StoreKit | |
//MARK: SKProductsRequestDelegate | |
extension IAPHelpers : SKProductsRequestDelegate | |
{ | |
func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse) | |
{ |
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
// An easy way to get different queue's in your project. | |
// | |
// GCDMan.swift | |
// GCDGhost | |
// | |
// Created by Alvin Varghese on 15/09/15. | |
// Copyright (c) 2015 iDreamCode. All rights reserved. | |
// |
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
// Example JSON | |
{ | |
"type": "articles", | |
"id": "1", | |
"attributes": { | |
"title": "Rails is Omakase" | |
}, | |
"relationships": { | |
"author": { |
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
// Adding Screen Edge Pan to the presenting viewController | |
@IBAction func showSafariViewController(sender: AnyObject) { | |
let safariViewController = IDMSafariViewController(URL: NSURL(string: "http://idreamcode.com")!) | |
safariViewController.delegate = self; | |
safariViewController.transitioningDelegate = self.transitionManager | |
safariViewController.modalPresentationStyle = UIModalPresentationStyle.Custom | |
self.transitionManager.transitionTo = kToManageReourceVC | |
self.presentViewController(safariViewController, animated: true) { () -> Void in | |
let recognizer = UIScreenEdgePanGestureRecognizer(target: self, action: "handleGesture:") |
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
// Handling the pan gesture method | |
func handleGesture(recognizer:UIScreenEdgePanGestureRecognizer) { | |
switch recognizer.state { | |
case .Began: () | |
case .Changed:dismissViewControllerAnimated(true, completion: nil) | |
case .Ended, .Cancelled: | |
(recognizer.velocityInView(view).x < 0) ? () : | |
dismissViewControllerAnimated(true, completion: 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
// | |
// HelloTransition.swift | |
// The Top Fives | |
// | |
// Created by Alvin Varghese on 9/13/15. | |
// Copyright (c) 2015 I dream Code. All rights reserved. | |
// | |
import UIKit |
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
// Main ViewController | |
import UIKit | |
import SafariServices | |
class ViewController: UIViewController, SFSafariViewControllerDelegate, UIViewControllerTransitioningDelegate { | |
let transitionManager : HelloTransition = HelloTransition() | |
@IBAction func showSafariViewController(sender: AnyObject){ |
OlderNewer