Skip to content

Instantly share code, notes, and snippets.

View vialyx's full-sized avatar
🎯
Focusing

Maxim Vialyx vialyx

🎯
Focusing
View GitHub Profile
final class RoundContainer: UIView {
var cornerRadius: CGFloat = 10.0 {
didSet {
layer.cornerRadius = cornerRadius
}
}
}
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
final class MyViewController : UIViewController {
weak var titleLabel: UILabel!
override func loadView() {
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
final class LayerView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
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()
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
}
#import <CommonCrypto/CommonCrypto.h>
//
// SegmentView.swift
// CustomUIView
//
// Created by Maksim Vialykh on 08.06.2018.
// Copyright © 2018 Vialyx. All rights reserved.
//
import UIKit
final class InteractiveModalTransitioningDelegate: NSObject, UIViewControllerTransitioningDelegate {
/*
.......
*/
// MARK: - UIViewControllerTransitioningDelegate
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
return InteractiveModalPresentationController(presentedViewController: presented, presenting: presenting)
}
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
final class MyViewController: UIViewController {
private var detailsTransitioningDelegate: InteractiveModalTransitioningDelegate!
/*
Some code
*/
@objc
private func labelDidTap() {