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
// http://stackoverflow.com/a/28800828/5552518 | |
import Foundation | |
import Alamofire | |
class ParallelServiceCaller { | |
var firstServiceCallComplete = false | |
var secondServiceCallComplete = false | |
func startServiceCalls() { |
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
// http://stackoverflow.com/a/33455882/5552518 | |
// xCode 8, Swift 3 | |
import UIKit | |
@IBDesignable | |
class SpinnerView: UIView { | |
override var layer: CAShapeLayer { | |
get { |
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
// http://stackoverflow.com/q/32371792/5552518 | |
func authenticateUser(completionHandler: (responseObject: String?, error: NSError?) -> ()) { | |
makeAuthenticateUserCall(completionHandler) | |
} | |
func makeAuthenticateUserCall(completionHandler: (responseObject: String?, error: NSError?) -> ()) { | |
Alamofire.request(.GET, loginUrlString) | |
.authenticate(user: "a", password: "b") | |
.responseString { request, response, responseString, responseError in |
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
//http://stackoverflow.com/a/34455483/5552518 | |
git rm $(git ls-files --deleted) |
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
// http://ashishkakkad.com/2016/03/how-to-create-a-wrapper-for-alamofire-and-swiftyjson-swift-ios/ | |
// | |
// AFWrapper.swift | |
// AFSwiftDemo | |
// | |
// Created by Ashish on 10/4/16. | |
// Copyright © 2016 Ashish Kakkad. 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
for view in self.view.subviews{ | |
print(view) | |
if view.isKind(of: SpinnerView.self) { | |
view.removeFromSuperview() | |
} | |
} | |
===== | |
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
// | |
// SwiftLoading.swift | |
// SwiftLoading | |
// | |
// Created by Tran Doan San on 10/17/15. | |
// Copyright © 2015 Tran Doan San. 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
let transition = CATransition() | |
transition.duration = 0.5 | |
transition.type = kCATransitionPush | |
transition.subtype = kCATransitionFromTop | |
view.window!.layer.add(transition, forKey: kCATransition) |
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
// detect device orientation | |
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { | |
if UIDevice.current.orientation.isLandscape { | |
self.view.backgroundColor = UIColor(patternImage: UIImage(named: "back-landscape")!) | |
} else { | |
self.view.backgroundColor = UIColor(patternImage: UIImage(named: "back-potrait")!) | |
} | |
} |
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 label = UILabel(frame: CGRect(x: 0, y: 0, width: 200, height: 21)) | |
label.center = CGPoint(x: 160, y: 285) | |
label.textAlignment = .center | |
label.text = "I'am a test label" | |
self.view.addSubview(label) |
OlderNewer