Easily access your ViewController on top of your view stack:
ez.topMostViewController?.presentViewController(myAlertController, animated: true, completion: nil)
// topMostViewController is your rootViewController
// Intended for showing small VCs like UIAlertControllerstring.length, string.capitalizefirst, string.trim, string.isemail,
Easily initialize your colors:
let myColor = UIColor(r: 100, g: 100, b: 100) // Default alpha is 1
Easily run block of codes after a certain delay:
Timer.runThisAfterDelay(seconds: 2) { () -> () in
print("Prints this 2 seconds later in main queue")
}
Easily run code every seconds:
var count = 0
Timer.runThisEvery(seconds: 1) { (timer) -> Void in
print("Will print every second")
if count == 3 {
timer?.invalidate()
}
count += 1
}
Easily access your projects version and build numbers:
print(ez.appVersion) // 0.3
print(ez.appBuild) // 7
print(ez.appVersionAndBuild) // v0.3(7)
Easily track screen shots:
ez.detectScreenShot { () -> () in
print("User took a screen shot")
}
Installation
Manually (~10 seconds)
Download and drop ‘/Sources’ in your project.
Congratulations!
Install via CocoaPods (~10 seconds)
You can use CocoaPods to install EZSwiftExtensions by adding it to your Podfile:
platform :ios, '8.0'
use_frameworks!
pod 'EZSwiftExtensions' #Stable release for Swift 3.0
pod 'EZSwiftExtensions', :git => 'https://github.com/goktugyil/EZSwiftExtensions.git' #Latest release for Swift 3.0
pod 'EZSwiftExtensions', :git => 'https://github.com/goktugyil/EZSwiftExtensions.git', :branch => 'Swift2.3' #For Swift 2.3
pod 'EZSwiftExtensions', '~> 1.6' #For Swift 2.2
To get the full benefits import EZSwiftExtensions wherever you import UIKit
Create a Cartfile that lists the framework and run carthage bootstrap. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/EZSwiftExtensions.framework to an iOS project.
github "goktugyil/EZSwiftExtensions"
Requirements
Swift 2 or later
Possible features
More extensions! Please if there is an extension you are constantly using, send a pull request now!
EZSwiftExtensions
How Swift standard types and classes were supposed to work. A collection of useful extensions for the Swift Standard Library, Foundation, and UIKit.
Join our online chat at
Example Usage
Easily get an object at a specified index:
Easily access a random element:
Easily find the indexes of an object:
Easily check if an array contains another array:
Block Objects These objects use completion blocks instead of selectors, taken from: CEMKit-Swift Easily initialize a BlockButton:
Easily convert between different types:
Easily toggle it:
Easily initialize your objects:
Easily access your ViewController on top of your view stack:
Easily initialize your colors:
Easily run block of codes after a certain delay:
Easily run code every seconds:
Easily access your projects version and build numbers:
Installation
Manually (~10 seconds)
Install via CocoaPods (~10 seconds)
You can use CocoaPods to install
EZSwiftExtensions
by adding it to yourPodfile
:To get the full benefits import
EZSwiftExtensions
wherever you import UIKitInstall via Carthage
Create a
Cartfile
that lists the framework and runcarthage bootstrap
. Follow the instructions to add$(SRCROOT)/Carthage/Build/iOS/EZSwiftExtensions.framework
to an iOS project.Requirements
Possible features
TODO
s in source code.Sources Used
And countless gists and stackoverflow answers.
License
EZSwiftExtensions is available under the MIT license. See the LICENSE file.
Keywords
swift, extension, uikit, exswift, foundation, library, framework, tool