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 | |
import Rswift | |
struct NibResource: NibResourceType { | |
let name: String | |
let bundle: NSBundle | |
init(name: String, bundle: NSBundle = NSBundle.mainBundle()) { | |
self.name = name | |
self.bundle = bundle |
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 UIView { | |
/// Convenience API to query iOS 11's `UIView.safeAreaInsets`'s insets (also known as "#NotEmbraceTheNotch") | |
/// in a backwards compatible API. | |
/// It also differs slightly from `UIView.safeAreaInsets` in that it only takes the "Notch" into account | |
/// and not the status bar. This allows you to inset content so that the notch doesn't clip it, but you can still | |
/// lay it out below the status bar. | |
/// Note: This won't be as versitile as the UIKit version because it won't take into account things like navigation bars, | |
/// but it should be correct for views in "full-screen" view controllers, where the UIKit `safeAreaInsets` API falls short. | |
var twSafeAreaInsets: UIEdgeInsets { | |
guard #available(iOS 11.0, *) 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
// | |
// DataLoadState.swift | |
// Fabric | |
// | |
// Created by Javier Soto on 3/16/16. | |
// Copyright © 2016 Fabric. All rights reserved. | |
// | |
import Foundation | |
import ReactiveCocoa |
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
find . -name '.DS_Store' -type f -delete |
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
func getLastVisibleController(ofParent parent: UIViewController? = nil) -> UIViewController? { | |
if let vc = parent { | |
if let tab = vc as? UITabBarController, let selected = tab.selectedViewController { | |
return getLastVisibleController(ofParent: selected) | |
} else if let nav = vc as? UINavigationController, let top = nav.topViewController { | |
return getLastVisibleController(ofParent: top) | |
} else if let presented = vc.presentedViewController { | |
return getLastVisibleController(ofParent: presented) | |
} else { | |
return vc |
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 will ignore Buld Forder and include all *.frameworks that was build | |
# add Build to repo to down the build time | |
# Carthage/Build/ | |
Carthage/Checkouts | |
Carthage/* | |
!Carthage/Build/ | |
Carthage/Build/* | |
!Carthage/Build/iOS/ | |
Carthage/Build/iOS/* |
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 UIImage { | |
//https://www.hackingwithswift.com/example-code/media/how-to-read-the-average-color-of-a-uiimage-using-ciareaaverage | |
var averageColor: UIColor? { | |
guard let inputImage = CIImage(image: self) else { return nil } | |
let extentVector = CIVector(x: inputImage.extent.origin.x, y: inputImage.extent.origin.y, z: inputImage.extent.size.width, w: inputImage.extent.size.height) | |
guard let filter = CIFilter(name: "CIAreaAverage", parameters: [kCIInputImageKey: inputImage, kCIInputExtentKey: extentVector]) else { return nil } | |
guard let outputImage = filter.outputImage else { return nil } | |
var bitmap = [UInt8](repeating: 0, count: 4) |
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
public extension UIApplication { | |
func clearLaunchScreenCache() { | |
#if DEBUG | |
do { | |
let launchScreenPath = "\(NSHomeDirectory())/Library/SplashBoard" | |
try FileManager.default.removeItem(atPath: launchScreenPath) | |
} catch { | |
print("Failed to delete launch screen cache - \(error)") | |
} | |
#endif |
NewerOlder