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
final class RoundContainer: UIView { | |
var cornerRadius: CGFloat = 10.0 { | |
didSet { | |
layer.cornerRadius = cornerRadius | |
} | |
} | |
} |
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
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
final class MyViewController : UIViewController { | |
weak var titleLabel: UILabel! | |
override func loadView() { |
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
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
final class LayerView: UIView { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
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
extension Data { | |
var hexString: String { | |
return self.reduce("", { $0 + String(format: "%02x", $1) }) | |
} | |
} | |
do { | |
let sourceData = "AES256".data(using: .utf8)! | |
let password = "password" | |
let salt = AES256Crypter.randomSalt() |
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
protocol Randomizer { | |
static func randomIv() -> Data | |
static func randomSalt() -> Data | |
static func randomData(length: Int) -> Data | |
} | |
protocol Crypter { | |
func encrypt(_ digest: Data) throws -> Data | |
func decrypt(_ encrypted: Data) throws -> Data | |
} |
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
#import <CommonCrypto/CommonCrypto.h> |
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
// | |
// SegmentView.swift | |
// CustomUIView | |
// | |
// Created by Maksim Vialykh on 08.06.2018. | |
// Copyright © 2018 Vialyx. All rights reserved. | |
// | |
import UIKit |
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
final class InteractiveModalTransitioningDelegate: NSObject, UIViewControllerTransitioningDelegate { | |
/* | |
....... | |
*/ | |
// MARK: - UIViewControllerTransitioningDelegate | |
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? { | |
return InteractiveModalPresentationController(presentedViewController: presented, presenting: presenting) | |
} |
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
enum ModalScaleState { | |
case presentation | |
case interaction | |
} | |
final class InteractiveModalPresentationController: UIPresentationController { | |
private let presentedYOffset: CGFloat = 150 | |
private var direction: CGFloat = 0 | |
private var state: ModalScaleState = .interaction |
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
final class MyViewController: UIViewController { | |
private var detailsTransitioningDelegate: InteractiveModalTransitioningDelegate! | |
/* | |
Some code | |
*/ | |
@objc | |
private func labelDidTap() { |