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 tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool { | |
if let fromView = tabBarController.selectedViewController?.view, | |
let toView = viewController.view, fromView != toView, | |
let controllerIndex = self.viewControllers?.firstIndex(of: viewController) { | |
let viewSize = fromView.frame | |
let scrollRight = controllerIndex > tabBarController.selectedIndex | |
if fromView.superview?.subviews.contains(toView) == true { return false } |
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
#1 Moya Target | |
import Foundation | |
import Moya | |
enum MyAPI { | |
// MARK: - User | |
case createUser(model: User) | |
case changePassword(currentPassword: String, newPassword: String) |
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
// Created by Vladyslav Semenchenko on 15/05/2017. | |
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved. | |
import Mapper | |
// 1: | |
class Camera: Mappable { | |
var cameraId: Int? | |
var title: String? | |
var isAvailable: Bool? |
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
// Created by Vladyslav Semenchenko on 15/05/2017. | |
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved. | |
NetworkAdapter.request(target: .cameras, success: { (response) in | |
// parse your data | |
}, error: { (error) in | |
// show error from server | |
}, failure: { (error) in | |
// show Moya error | |
}) |
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
// Created by Vladyslav Semenchenko on 15/05/2017. | |
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved. | |
import Moya | |
struct NetworkAdapter { | |
static let provider = MoyaProvider<MyServerAPI>() | |
static func request(target: MyServerAPI, success successCallback: @escaping (Response) -> Void, error errorCallback: @escaping (Swift.Error) -> Void, failure failureCallback: @escaping (MoyaError) -> Void) { | |
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
// Created by Vladyslav Semenchenko on 15/05/2017. | |
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved. | |
let provider = MoyaProvider<MyServerAPI>() | |
provider.request(.cameras) { (result) in | |
switch result { | |
case .success(let response): | |
// do something with resoinse | |
case .failure(let error): | |
// show error |
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
// Created by Vladyslav Semenchenko on 15/05/2017. | |
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved. | |
import Foundation | |
import Moya | |
// 1: | |
enum MyServerAPI { | |
// MARK: - Cameras |
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
// Created by Vladyslav Semenchenko on 09/04/2017. | |
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved. | |
import UIKit | |
class InitialViewController: EZViewController { | |
// MARK: - Variables | |
@IBOutlet var sceneAnimations: InitialViewControllerAnimations! | |
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
// Created by Vladyslav Semenchenko on 09/04/2017. | |
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved. | |
import UIKit | |
class InitialViewControllerAnimations: NSObject { | |
@IBOutlet weak var controlsContainer: UIView! | |
@IBOutlet weak var ivLogoHorizontalConstraint: NSLayoutConstraint! | |
NewerOlder