π―
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
class MainController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
present(DetailController(), animated: 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
class DetailController: UIViewController { | |
let transition = MenuTransition() | |
init() { | |
super.init(nibName: "DetailController", bundle: nil) | |
modalPresentationStyle = .custom | |
transitioningDelegate = transition | |
} | |
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
class Interactor: UIPercentDrivenInteractiveTransition { | |
var hasStarted = false | |
var shouldFinish = false | |
} |
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 | |
class PresentationController: UIPresentationController { | |
private var chrome: UIView = UIView() | |
var interactor: Interactor? = nil | |
override var frameOfPresentedViewInContainerView: CGRect { | |
guard let containerView = containerView, | |
let presentedView = presentedView else { return .zero } |
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
class CustomPresentation: UIPresentationController { | |
override var frameOfPresentedViewInContainerView: CGRect { | |
return CGRect(x: 0, y: containerView!.bounds.height / 2, width: containerView!.bounds.width, height: containerView!.bounds.height / 2) | |
} | |
override func containerViewWillLayoutSubviews() { | |
presentedView?.center = .zero | |
presentedView?.frame = frameOfPresentedViewInContainerView | |
} | |
} |
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 | |
class User: NSObject { | |
@objc dynamic var name: String? | |
init(with name: String) { | |
super.init() | |
self.name = name | |
} |
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
protocol EndPointType { | |
var baseURL: URL { get } | |
var path: String { get } | |
var parameters: [String:Any]? { get } | |
var httpMethod: HTTPMethod { get } | |
var task: HTTPTask { get } | |
var header: [String:String]? { 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
private func generateBoundary() -> String { | |
return "Boundary-\(UUID().uuidString)" | |
} | |
private func createDataBody(withParamaeters parameters: Parameters?, media: [Media]?, boundary: String) -> Data { | |
var body = Data() | |
let linebreak = "\r\n" | |
if let parameters = parameters { | |
for (key, value) in parameters { | |
body.append("--\(boundary + linebreak)") |