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 | |
final class SheetModalPresentationController: UIPresentationController { | |
// MARK: Private Properties | |
private let isDismissable: Bool | |
private let interactor = UIPercentDrivenInteractiveTransition() | |
private let dimmingView = UIView() | |
private var propertyAnimator: UIViewPropertyAnimator! |
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 | |
extension UIView { | |
var allSubviews: [UIView] { | |
subviews + subviews.flatMap { $0.allSubviews } | |
} | |
func firstSubview<T: UIView>(of type: T.Type) -> T? { | |
allSubviews.first { $0 is T } as? T |
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 | |
final class ViewController: UITableViewController { | |
private var names: [String] = (50...99).map { String($0) } | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { |
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
#!/bin/bash | |
CLASSES_FOLDERS=($PROJECT_NAME) | |
RESOURCE_FOLDER=$PROJECT_NAME | |
function show_code { | |
for ClassFolder in "${CLASSES_FOLDERS[@]}"; do | |
# try to find image name in [UIImage imageNamed:] pattern | |
ERROR_LOCATION=$(grep -Ron "\[UIImage imageNamed:@\"$1\"]" $ClassFolder) | |
if [[ -n $ERROR_LOCATION ]]; then break; fi; |
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
// | |
// Storage.swift | |
// | |
// Created by Grigory Avdyushin on 30.06.16. | |
// Copyright © 2016 Grigory Avdyushin. All rights reserved. | |
// | |
import UIKit | |
import CoreData |
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 PHPhotoLibrary { | |
typealias PhotoAsset = PHAsset | |
typealias PhotoAlbum = PHAssetCollection | |
static func saveImage(image: UIImage, albumName: String, completion: (PHAsset?)->()) { | |
if let album = self.findAlbum(albumName) { | |
saveImage(image, album: album, completion: completion) | |
return | |
} |
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
/* This SnapshotHelper class should be compatible with SnapshotHelper.swift version 1.2 */ | |
@import Foundation; | |
@import XCTest; | |
@interface SnapshotHelper : NSObject | |
- (instancetype)initWithApp:(XCUIApplication*)app; | |
- (void)snapshot:(NSString*)name waitForLoadingIndicator:(BOOL)wait; |
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
// | |
// UIColor.swift | |
// previously Color+HexAndCSSColorNames.swift | |
// | |
// Created by Norman Basham on 12/8/15. | |
// Copyright ©2018 Black Labs. All rights reserved. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights |
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
//first | |
dispatch_async(queue, ^{ | |
dispatch_group_t group1 = dispatch_group_create(); | |
// Tasks goes here | |
for (NSInteger i = 0; i < 3; i++) { |
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 UIStoryboardSegueFromRight: UIStoryboardSegue { | |
override func perform() | |
{ | |
let src = self.sourceViewController as UIViewController | |
let dst = self.destinationViewController as UIViewController | |
src.view.superview?.insertSubview(dst.view, aboveSubview: src.view) |
NewerOlder