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
let backgroundView = UIView.mock(backgroundColor: .neon(.violet)) | |
let box1 = UIView.mock(backgroundColor: .neon(.red), preferredSize: .largeSquare) | |
let box2 = UIView.mock(backgroundColor: .neon(.yellow), preferredSize: .largeSquare) | |
view.addSubview(backgroundView) | |
view.addSubview(box1) | |
view.addSubview(box2) | |
backgroundView.translatesAutoresizingMaskIntoConstraints = false | |
box1.translatesAutoresizingMaskIntoConstraints = 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
/// For Transition | |
public final class ComposedCornerView: CodeBasedView { | |
private let topRightMaskView = UIView() | |
private let topLeftMaskView = UIView() | |
private let bottomRightMaskView = UIView() | |
private let bottomLeftMaskView = UIView() | |
private let topRightView = UIView() | |
private let topLeftView = UIView() |
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 ObjectiveC | |
import UIKit | |
let swizzle: Void = { | |
print("swizzle") | |
method_exchangeImplementations( | |
class_getInstanceMethod(UIScrollView.self, #selector(setter:UIScrollView.contentInset))!, | |
class_getInstanceMethod(UIScrollView.self, #selector(UIScrollView._mmm_setContentInset))! |
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 | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
let newWindow = UIWindow() |
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 AsyncDisplayKit | |
import Foundation | |
import KeyboardGuide | |
import AppFoundation | |
/** | |
A sub-class of ASCollectionNode that supports handling the height of the Keyboard. | |
Using `KeyboardGuide`, it changes its contentInset and scroll-indicator regarding the relative height of the Keyboard. |
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
open class ZStackView: UIView { | |
public init(views: [UIView]) { | |
super.init(frame: .zero) | |
views.forEach { view in | |
addSubview(view) | |
view.translatesAutoresizingMaskIntoConstraints = 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 Foundation | |
public final class InputFilter { | |
private final class Storage<T> { | |
let lock = NSLock() |
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
//: [Previous](@previous) | |
import Foundation | |
final class FilterStorage { | |
private var storage: [String: Any] = [:] | |
func comparer<T>(for key: String) -> ((T) -> Bool)? { | |
guard let object = storage[key] else { |
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
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{ | |
[super setHighlighted:highlighted]; | |
[self setNeedsDisplay]; | |
if (animated) { | |
[UIView transitionWithView:self duration:0.1 | |
options:UIViewAnimationOptionTransitionCrossDissolve | |
animations:^{ | |
[self.layer displayIfNeeded]; | |
} 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
extension CGImage { | |
enum Flipping { | |
case vertically | |
case horizontally | |
} | |
func rotated(angle: CGFloat, flipping: Flipping? = nil) throws -> CGImage | |
{ | |
guard angle != 0 else { |