TinySwift
Requirements
Swift 3.2-5.7
iOS 8+, tvOS 9+, watchOS 2+
Installation
TinySwift is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "TinySwift"
Usage
TinySwift is an extension pack for Swift classes and structs.
It contains the following functions and properties:
AVAsset
var thumbnail
iOS, tvOS
Bool
init(_: Integer)
iOS, tvOS, watchOSstatic var random
iOS, tvOS, watchOSfunc toggle()
iOS, tvOS, watchOS
CGAffineTransform
var rotationAngle
iOS, tvOS, watchOSvar scaleX
iOS, tvOS, watchOSvar scaleY
iOS, tvOS, watchOS
Collection
var random
iOS, tvOS, watchOS
Array
subscript(safe:)
iOS, tvOS, watchOSvar shuffled
iOS, tvOSfunc remove(element:)
iOS, tvOS, watchOSfunc shuffle()
iOS, tvOS
RandomAccessCollection
var appearances
iOS, tvOS, watchOSvar arithmeticMean
iOS, tvOS, watchOSvar areAllElementsEqual
iOS, tvOS, watchOSvar geometricMean
iOS, tvOS, watchOSvar median
iOS, tvOS, watchOSvar mode
iOS, tvOS, watchOSvar set
iOS, tvOS, watchOSvar standardDeviation
iOS, tvOS, watchOSvar sum
iOS, tvOS, watchOSvar variance
iOS, tvOS, watchOS
Data
init(hexadecimalString:)
iOS, tvOS, watchOSvar hexadecimalString
iOS, tvOS, watchOSfunc qrCode(correctionLevel:)
iOS, tvOS
Date
var day
iOS, tvOS, watchOSvar firstOfMonth
iOS, tvOS, watchOSvar firstOfYear
iOS, tvOS, watchOSvar lastOfMonth
iOS, tvOS, watchOSvar lastOfYear
iOS, tvOS, watchOSvar month
iOS, tvOS, watchOSvar nextDay
iOS, tvOS, watchOSvar previousDay
iOS, tvOS, watchOSvar weekday
iOS, tvOS, watchOSvar year
iOS, tvOS, watchOS
FloatingPoint
var additiveInverse
iOS, tvOS, watchOSvar degreesToRadians
iOS, tvOS, watchOSvar multiplicativeInverse
iOS, tvOS, watchOSvar radiansToDegrees
iOS, tvOS, watchOS
Integer
var additiveInverse
iOS, tvOS, watchOSvar days
iOS, tvOS, watchOSvar degreesToRadians
iOS, tvOS, watchOSvar factorial
iOS, tvOS, watchOSvar hours
iOS, tvOS, watchOSvar isEven
iOS, tvOS, watchOSvar isOdd
iOS, tvOS, watchOSvar isPrime
iOS, tvOS, watchOSvar minutes
iOS, tvOS, watchOSvar multiplicativeInverse
iOS, tvOS, watchOSvar radiansToDegrees
iOS, tvOS, watchOSvar seconds
iOS, tvOS, watchOS
Int
init(random:)
iOS, tvOS, watchOSvar random
iOS, tvOS, watchOSfunc times(execute:)
iOS, tvOS, watchOS
NSAttributedString
func formatted(substring:font:)
iOS, tvOS, watchOS
String
init(path:)
iOS, tvOS, watchOSinit(random:length:nonRepeating:)
iOS, tvOS, watchOSvar camelCased
iOS, tvOS, watchOSvar dataFromHexadecimalString
iOS, tvOS, watchOSvar emptyIfNil
iOS, tvOS, watchOSvar initials
iOS, tvOS, watchOSvar isEmailAddress
iOS, tvOS, watchOSvar lines
iOS, tvOS, watchOSvar localized
iOS, tvOS, watchOSvar nilIfEmpty
iOS, tvOS, watchOSvar nonEmptyLines
iOS, tvOS, watchOSvar trimmed
iOS, tvOS, watchOSvar upperCamelCased
iOS, tvOS, watchOSfunc formatted(substring:font:)
iOS, tvOS, watchOSfunc occurrences(of:)
iOS, tvOS, watchOSfunc qrCode(correctionLevel:encoding:)
iOS, tvOS
TimeInterval
func time(with:)
iOS, tvOS, watchOS
UIColor
init(hex:alpha:)
iOS, tvOS, watchOSvar hex
iOS, tvOS, watchOS
UIDevice
var device
iOS, tvOSvar deviceCode
iOS, tvOSvar diskSize
iOS, tvOSvar freeDiskSpace
iOS, tvOS
UIImage
init(color:size:)
iOS, tvOS, watchOSvar grayscale
iOS, tvOSvar normalizedImage
iOS, tvOS, watchOSvar png
iOS, tvOS, watchOSvar square
iOS, tvOS, watchOSvar thumbnail
iOS, tvOS, watchOSstatic func get(from:completion:)
iOS, tvOS, watchOSfunc border(width:color:)
iOS, tvOS, watchOSfunc color(at:)
iOS, tvOS, watchOSfunc crop(to:)
iOS, tvOS, watchOSfunc heic(quality:)
iOS, tvOSfunc jpeg(quality:)
iOS, tvOS, watchOSfunc resize(to:)
iOS, tvOS, watchOS
UIImageView
func setImage(from:placeholder:completion:)
iOS, tvOSfunc sharpenForQRCode()
iOS, tvOS
UIScreen
var isLowResolution
tvOSvar isSmallScreen
iOSvar size
iOS
UITableViewCell
func hideSeparator()
iOS
UIView
var viewFromNib
iOS, tvOS
UIViewController
func presentAlertController(withTitle:message:completion:handler:)
iOS, tvOS
URL
func qrCode(correctionLevel:encoding:)
iOS, tvOS
WKInterfaceDevice
var device
watchOSvar isSmaller
watchOSvar isLarger
watchOS
Author
Piotr Sochalewski, sochalewski.github.io
License
TinySwift is available under the MIT license. See the LICENSE file for more info.