swifthelpers
This repository contains helping reusable extensions for Swift
SwiftHelpers is available through CocoaPods (Currently failing, I need to set up cocoapods first, please be patient):
pod ‘SwiftHelpers’, :git => ‘https://github.com/PhilippMatthes/swifthelpers.git’
Import using import SwiftHelpers
All Contents
- ArrayExtension.swift
- Remove duplicates from Array
- Filter duplicates by comparison
- BadgeExtension.swift
- Addable and removable text badge
- CGSizeExtension.swift
- Makes CGSize compatible to the multiplication operator
- CLLocationExtension.swift
- Fetch country and city to Location
- DateExtension.swift
- Compute time difference between two dates in seconds, months, minutes...
- EquatableExtension.swift
- Check if an object is any of an object in a collection
- IntExtension.swift
- Calculate modulo as alternative to the remainder operator % (returns non-negative values)
- Check if index is out of range in array
- MKCoordinateRegionExtension.swift
- Calculate radius of map region
- MapViewExtension.swift
- Zoom fit overlays on map
- OptionalExtension.swift
- Check if optional collection is empty or nil
- SFSafariViewControllerExtension.swift
- Initialize SFSVC with given color (iOS 10.0 and above)
- UIColorExtension.swift
- Initialize color with hex code
- Get RGB components
- Interpolate color to other color with given percentage
- Lighter, Darker, Adjust
- UIControlExtension.swift
- Makes it possible to create buttons which trigger actions by closures, not directly through selectors
- UIImageExtension.swift
- Image with alpha
- Initialize Image with color and given size
- UINaviationBarExtension.swift
- Animate bar tint color with given time interval
- UITabBarExtension.swift
- Animate bar tint color
- Set tint color of bar items
- UIViewControllerExtension.swift
- Add gesture recognizer to hide keyboard when tapped around
- Dismiss keyboard @objc method
- Perform segue to return back / Return back @objc method (May need Navigation Controller)
- UIViewExtension.swift
- Add blur effect
- Check if blur effect is applied (To avoid adding it twice or more)
- Round corners by BezierPath
- URLExtension.swift
- Makes URL creatable through string literal
- UserDefaultsExtension.swift
- Generic function to call object from storage
- Generic function to save object to storage
- Generic function to append object to list with identifier
Feel free to contribute to my extension library. Helping hands are welcome!
MIT License
Copyright (c) 2018 Philipp Matthes
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 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.