Swiftpack.co -  gintsmurans/SwiftCollection as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
gintsmurans/SwiftCollection
Swift Extensions
.package(url: "https://github.com/gintsmurans/SwiftCollection.git", from: "0.3.1")

SwiftCollection

Collection of various Swift sources: Controllers, Classes, Extensions, and more, that I have put together my self and from samples found while googling around.

Requires: Swift 4.2+

Extensions

  • eArray.swift

    • removeObject() -> Remove object from array.
    • replaceNull() -> Replaces alll null(nil) objects.
    • categorise() -> Make dict from array based on key.
  • eAVAsset.swift

    • firstVideoFrameFromURL() -> Class method that returns instance of UIImage containing first frame of video asset loaded from the url specified by "url" parameter.
    • firstVideoFrame() -> Returns instance of UIImage containing first frame of current video asset.
    • videoFrameAt() -> Returns instance of UIImage containing frame at time specified by "seconds" parameter.
    • videoFrameAt() -> Returns instance of UIImage containing frame at time specified by "time" parameter.
  • eBundle.swift

    • pathForResource() -> Returns path for app's resources.
  • eDate.swift

    • dateComponents -> Access date's components.
    • format() -> Returns formatted string.
  • eDictionary.swift

    • jsonString() -> Returns jsonString made from current NSDictionary.
    • init() -> Inits NSDictionary object from json string.
    • replaceNull() -> Replaces all null(nil) elements.
  • eString.swift

    • containsOnly() -> Returns whether current string contains only characters in a set. passed as parameter.
    • isValidEmail() -> Validates email address.
  • eUIColor.swift

    • init(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> Helper to init UIColor based on RGBA value.
  • eUIImage.swift

    • init?(color: UIColor, size: CGSize) -> Init blank image with background color and size.
    • crop() -> Crop image to specific size.
    • cropToSquare() -> Crop image to squared size by searching the shortest first.
    • resize() -> Resize image based on size and ContentMode.
    • fixImageOrientation() -> Fix image orientation by rotating and setting its rotation tags as them should be.
  • eUINavigationController.swift

    • popViewControllerAnimatedWithHandler() -> Pop view controller animated + call completion handler after animation is done animating.
  • eUIView.swift

    • viewWithTagRecursive() -> Search for a view with tag recursively.

Controllers

  • BasicSearchController - A template for a UITableView search controller.

Classes

  • CacheObject - Load, save, use data, currently only supports UserDefaults.standard.
  • CUIButton - Custom button that allows setting background colors for multiple button modes in interface builder.
  • PaddedUITextField - Add padding to UITextField.

GitHub

link
Stars: 3
Last commit: 4 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Related Packages

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API