Skip to content

Instantly share code, notes, and snippets.

View pffan91's full-sized avatar
🌍
Developing the Future

Vladyslav Semenchenko pffan91

🌍
Developing the Future
View GitHub Profile
@pffan91
pffan91 / DecomposingViewControllersAnimations_OriginalCode.swift
Created April 9, 2017 17:18
DecomposingViewControllersAnimations_OriginalCode
// Created by Vladyslav Semenchenko on 09/04/2017.
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved.
import UIKit
class InitialViewController: EZViewController {
// MARK: - Variables
@IBOutlet weak var controlsContainer: UIView!
@pffan91
pffan91 / DecomposingViewControllerAnimations_ClassForAnimations.swift
Last active April 9, 2017 17:29
DecomposingViewControllerAnimations_ClassForAnimations
// Created by Vladyslav Semenchenko on 09/04/2017.
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved.
import UIKit
class InitialViewControllerAnimations: NSObject {
class func animateLoginPresentation(imageHorizontalConstraint: NSLayoutConstraint, controlsContainer: UIView) {
imageHorizontalConstraint.constant = -150
UIView.animate(withDuration: 0.7, delay: 0.5, options: .curveEaseInOut, animations: {
AnimationHelper.currentViewController()?.view.layoutIfNeeded()
@pffan91
pffan91 / DecomposingViewControllerAnimations_CallFunction.swift
Last active April 9, 2017 18:03
DecomposingViewControllerAnimations_CallFunction
// Created by Vladyslav Semenchenko on 09/04/2017.
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved.
// MARK: - Private
func checkUser() {
// some code here and then
InitialViewControllerAnimations.animateLoginPresentation(imageHorizontalConstraint: ivLogoHorizontalConstraint, controlsContainer: controlsContainer)
}
@pffan91
pffan91 / DecomposingViewControllerAnimations_FinalAnimationClass.swift
Created April 9, 2017 17:56
DecomposingViewControllerAnimations_FinalAnimationClass
// 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!
@pffan91
pffan91 / DecomposingViewControllerAnimations_FinalViewControllerClass.swift
Created April 9, 2017 17:59
DecomposingViewControllerAnimations_FinalViewControllerClass
// 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!
@pffan91
pffan91 / NetworkLayerWithMoya.swift
Created May 15, 2017 11:22
NetworkLayerWithMoya
// Created by Vladyslav Semenchenko on 15/05/2017.
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved.
import Foundation
import Moya
// 1:
enum MyServerAPI {
// MARK: - Cameras
@pffan91
pffan91 / NetworkLayerWithMoya_sendRequest.swift
Last active November 29, 2017 09:46
NetworkLayerWithMoya_sendRequest
// 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
@pffan91
pffan91 / NetworkLayerWithMoya_networkAdapter.swift
Last active February 16, 2018 18:31
NetworkLayerWithMoya_networkAdapter
// 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) {
@pffan91
pffan91 / NetworkLayerWithMoya_sendRequestViaAdapter.swift
Last active May 15, 2017 17:54
NetworkLayerWithMoya_sendRequestViaAdapter
// 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
})
@pffan91
pffan91 / NetworkLayerWithMoya_customObject.swift
Created May 15, 2017 18:01
NetworkLayerWithMoya_customObject
// 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?