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
    
  
  
    
  | // | |
| // 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
    
  
  
    
  | #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
    
  
  
    
  | 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
    
  
  
    
  | 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
    
  
  
    
  | //: 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
    
  
  
    
  | //: 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
    
  
  
    
  | 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
    
  
  
    
  | let container = RoundContainer() | |
| container.backgroundColor = .blue | |
| container.cornerRadius = 40 | |
| container.translatesAutoresizingMaskIntoConstraints = false | |
| roundContainer = container | |
| view.addSubview(container) | |
| NSLayoutConstraint.activate([ | |
| container.centerXAnchor.constraint(equalTo: view.centerXAnchor), | 
  
    
      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
    
  
  
    
  | override var intrinsicContentSize: CGSize { | |
| return CGSize(width: cornerRadius * 4, height: cornerRadius * 2) | |
| } |