Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ playground.xcworkspace
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace
*.xcworkspace

# Carthage
#
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions less6/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'loginForm' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'Alamofire', '~> 4.8'
pod 'RealmSwift'
pod 'SwiftyJSON'
# Pods for loginForm

end
30 changes: 30 additions & 0 deletions less6/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
PODS:
- Alamofire (4.9.1)
- Realm (4.3.2):
- Realm/Headers (= 4.3.2)
- Realm/Headers (4.3.2)
- RealmSwift (4.3.2):
- Realm (= 4.3.2)
- SwiftyJSON (5.0.0)

DEPENDENCIES:
- Alamofire (~> 4.8)
- RealmSwift
- SwiftyJSON

SPEC REPOS:
trunk:
- Alamofire
- Realm
- RealmSwift
- SwiftyJSON

SPEC CHECKSUMS:
Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18
Realm: 5e92902e2875dff4bb0fd02f67bb737c3d5db2bc
RealmSwift: 9a360fc7bae04fc2e308a34fbd899d5faa2d6b22
SwiftyJSON: 36413e04c44ee145039d332b4f4e2d3e8d6c4db7

PODFILE CHECKSUM: 9e4404f69107ecf09e634ce7ce8ed833388709b5

COCOAPODS: 1.9.1
551 changes: 551 additions & 0 deletions less6/loginForm.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// CustomInteractiveTransition.swift
// loginForm
//
// Created by OSTO macOS on 05.03.2020.
// Copyright © 2020 prot. All rights reserved.
//

import UIKit

class CustomInteractiveTransition: UIPercentDrivenInteractiveTransition {
var viewController: UIViewController? {
didSet {
let recongizer = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(handleScreenEdgeGesture(_:)) )
recongizer.edges = [.left]
viewController?.view.addGestureRecognizer(recongizer)
}
}

var hasStarted: Bool = false
var shouldFinish: Bool = false

@objc func handleScreenEdgeGesture(_ gesture: UIScreenEdgePanGestureRecognizer) {
switch gesture.state {
case .began:
hasStarted = true
viewController?.navigationController?.popViewController(animated: true)

case .changed:
let translation = gesture.translation(in: gesture.view)
let relativeTransition = translation.y / (gesture.view?.bounds.width ?? 1)
let progress = max(0, min(1, relativeTransition))
shouldFinish = progress > 0.33
update(progress)

case .ended:
hasStarted = false
if shouldFinish {
finish()
}
else {
cancel()
}

case .cancelled:
hasStarted = false
cancel()

default:
return
}

}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// CustomNavigationController.swift
// loginForm
//
// Created by OSTO macOS on 04.03.2020.
// Copyright © 2020 prot. All rights reserved.
//

import UIKit

class CustomNavigationController: UINavigationController, UINavigationControllerDelegate {

let interactiveTransition = CustomInteractiveTransition()

override func viewDidLoad() {
super.viewDidLoad()

delegate = self
}


func navigationController(_ navigationController: UINavigationController, interactionControllerFor animationController: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
return interactiveTransition.hasStarted ? interactiveTransition: nil
}

func navigationController(_ navigationController: UINavigationController,
animationControllerFor operation: UINavigationController.Operation,
from fromVC: UIViewController,
to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {

if operation == .pop {
if navigationController.viewControllers.first != toVC {
interactiveTransition.viewController = toVC
}
return CustomPopAnimator()
}else if operation == .push {
interactiveTransition.viewController = toVC
return CustomPushAnimator()
}
return nil

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
//
// CustomPushAnimator.swift
// loginForm
//
// Created by OSTO macOS on 04.03.2020.
// Copyright © 2020 prot. All rights reserved.
//

import UIKit

class CustomPushAnimator: NSObject, UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return 0.6
}

func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let source = transitionContext.viewController(forKey: .from),
let destination = transitionContext.viewController(forKey: .to) else { return }
destination.view.frame = source.view.frame
transitionContext.containerView.addSubview(destination.view)

destination.view.transform = CGAffineTransform(rotationAngle: -(.pi / 2))
destination.view.layer.anchorPoint = CGPoint(x: 1, y: 0)
destination.view.layer.position = CGPoint(x: 414, y: 0)

UIView.animateKeyframes(withDuration: self.transitionDuration(using: transitionContext),
delay: 0,
options: .calculationModePaced,
animations: {
UIView.addKeyframe(withRelativeStartTime: 0,
relativeDuration: 0.4,
animations: {
source.view.alpha = 0.7
})

UIView.addKeyframe(withRelativeStartTime: 0.4,
relativeDuration: 0.4,
animations: {
destination.view.transform = .identity
})

}) { finished in
if finished && !transitionContext.transitionWasCancelled {
source.view.transform = .identity
}

transitionContext.completeTransition(finished && !transitionContext.transitionWasCancelled)
}
}
}




class CustomPopAnimator : NSObject, UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return 0.6
}

func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let source = transitionContext.viewController(forKey: .from),
let destination = transitionContext.viewController(forKey: .to) else { return }

transitionContext.containerView.addSubview(destination.view)
transitionContext.containerView.sendSubviewToBack(destination.view)

destination.view.frame = source.view.frame

UIView.animateKeyframes(withDuration: self.transitionDuration(using: transitionContext),
delay: 0,
options: .calculationModePaced,
animations: {

UIView.addKeyframe(withRelativeStartTime: 0,
relativeDuration: 0.4,
animations: {
source.view.transform = CGAffineTransform(rotationAngle: -(.pi / 2))
destination.view.alpha = 1
})
UIView.addKeyframe(withRelativeStartTime: 0.4,
relativeDuration: 0.4,
animations: {
destination.view.transform = .identity
})

}) { finished in
if finished && !transitionContext.transitionWasCancelled {
source.removeFromParent()
} else if transitionContext.transitionWasCancelled {
destination.view.transform = .identity
}
transitionContext.completeTransition(finished && !transitionContext.transitionWasCancelled)
}
}
}
37 changes: 37 additions & 0 deletions less6/loginForm/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// AppDelegate.swift
// loginForm
//
// Created by prot on 30/01/2020.
// Copyright © 2020 prot. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

98 changes: 98 additions & 0 deletions less6/loginForm/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
6 changes: 6 additions & 0 deletions less6/loginForm/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading