Latest 1.7.0
Homepage https://github.com/jVirus/extensions-kit
License MIT
Platforms ios 11.0, requires ARC
Authors

extensions-kit Awesome

[Platforms]()
[Language]()
[Coverage]()
[Documentation]()
[CocoaPod]()
[License]()

Last Update: 27/November/2018.

extensions-kit

✍️ About

📦 Collection of Swift extensions(+ custom types) for various use cases. The kit contains 170 extensions + 19 custom types.

🏗 Installation

CocoaPods

extensions-kit is availabe via CocoaPods

pod 'extensions-kit', '~> 1.7.0' 

Manual

You can always use copy-paste the sources method 😄. Or you can compile the framework and include it with your project.

🍱 Categories

List of categories for convenient navigation. The numbers represent total number of extensions for a given category + custom types. Each extension file may contain a number of extensions, grouped by a category.

📚 List of Extensions

All the extensions are split into separete groups each of which represents a separete SDK framework.

AppKit

NSBezierPath

  • NSBezierPath+cgPath – adds missing cgPath property that converts self (port of similar functionality from iOS)

AVFoundation

Core Animation

CAAnimation

Core Graphics

CGSize

  • CGSize+Operators – adds various mathematical operators such as +, -, *, / for convenience

CGPoint

  • CGPoint+Operators – various mathematical operators such as +, -, *, /, lerp etc.
  • CGPoint+Utils – missing mathematical utilities such as normalized, lenght, distanceTo and angle

CGRect

  • CGRect+Scale – scales self to the specified size
  • CGRect+Corners – adds properties for topLeft, topRight, bottomLeft and bottomRight points
  • CGRect+Mid – adds property for mid point of self
  • CGRect+AspectFit – adds aspectFit(inRect: CGRect) -> CGRect method that scales self to fit the specified CGRect

CGFloat

CoreImage

New Filters

  • HighlightFilter – filter is originally designed for highlighting 3D objects but can be used to add this effect to images and sprites

Foundation

Functions

  • FunctionalComposition – is a functions that implements Functional Composition concept which allows to combine multiple functions and chain them together, in order to transform data. Consider the following construction: (doubleNumbers ->> squareNumbers ->> convertToStringArray)(array) which returns a processed array by linearly composing the functions (rather that nesting the function calls). Also the extension includes the reversed operator that composes functions in reversed order.

Data Structures

  • LensLens is an implementation of Functional Lenses concept that allows to safely modify immutable structs and provides fundamental tools to work with complex data structures (see UnitTests)
  • ObjectPool – thread-safe implementation of ObjectPool design pattern
  • Observer – thread-safe implementation of Observer design pattern (don’t confuse with NotiifcationCenter – it’s an implementation of Publish-Subscribe pattern)
  • MulticastDelegation – non thread-safe implementation of MulticastDelegation design pattern
  • Stack – is an implementation of Stack data structure
  • Queue – is an implementation of Queue data structure
  • ProrityQueue – is an implementation of Prority Queue data structure based on Heap data structure
  • Dequeue – is an implementation of Dequeue data structure
  • LinkedList – is an implementation of Linked List data structure
  • DoublyLinkedList – is an implementation of Doubly Linked List data structure
  • Heap – is an implementation of Heap data structure

Extensions

Array

Bool

  • Bool+Int – adds a property that returns Int representation of self
  • Bool+Random – adds a random property for self

ClosedRange

Collection

RandomAccessCollection

Dictionary

Double

Date

  • Date+FirstLast – adds a number of properties that allow to quickly access: first day of a week, start of a day, end of a day and a number of days in a month
  • Date+PreviousNext – adds properties that allow to get access to the previous and next days

Float

Int

  • Int+Clamp – clamps self into a range that can be described using ClosedRange or two separate properties
  • Int+Digits – adds digitCount property that contains the number of digits for self
  • Int+EvenOdd – checks whether self is even or if it’s odd
  • Int+Factorial – computes factorial of self
  • Int+Power – operator that performs exponentiation matematical operation, where left number is the base and the right one is the exponent
  • Int+Random – generates pseudo-random number in a range that can be specified as ClosedRange or two separate Int properties
  • Int+Roman – converts self into Roman number (as String)
  • Int+DecimalToBinary – allows to convert decimal number to binary format and vice versa

OptionSet

MutableCollection

Sequence

String

  • String+Digits – combines decimal digits into a single String property
  • String+FormattedDate – creates a Date instance from self based in the specified format
  • String+IndexOf – finds the first occurence for a given String
  • String+Base64 – encodes/decodes self to Base64 encoding
  • String+Validation – contains a number of extensions for validating String based on the following: isAlphanumeric, hasLetters, hasNumbers, isEmail, isAlphabetic

UIKit

UIScreen

UIApplication

  • UIApplication+SafeAreas – contains extensions that allow to get numerical representations of top and bottom safe areas

NSLayoutConstraint

UIView

  • UIView+CACorners – convenience extension for setting and getting round corners
  • UIView+BezierRoundedCorners – yet another extension for rounding corners
  • UIView+HuggingPriority – convenience wrappers that simplify inerfaces for setContentHuggingPriority and setContentCompressionResistancePriority methods
  • UIView+Screenshot – allows to take a screenshot of self
  • UIView+Constraints – adds convenience auto-layout methods that allow to pin, add, get height & width and to get all the constrains for a particular UIView
  • UIView+LayoutAnimation – adds animation extensions that operate on layout constraints

UIColor

  • UIColor+ColorComponents – adds support for missing color components properties such as rgba, hsba and grayscale

UICollectionView

UITableView

UIImage

UIImageView

UIViewController

  • UIViewController+ChildViewControllers – addds convenience methods for adding and removing child view controllers
  • UIViewController+Storyboard – instantiates a UIViewController instance from a Storyboard using the UIViewController's name as a reference name of the Storyboard file. Used in cases when Coordinator or Flow design patterns need to be implemented

SpriteKit

SKEmitterNode

SKSpriteNode

  • SKSpriteNode+GIF – adds support for uploading and playing GIFs from local files

SKScene

  • SKScene+SerialSpriteLoading – uploads a set of scene graph nodes with a specific pattern, useful when a scene contains a lot of nodes, but just a specific subset needs to be processed or accessed
  • SKScene+ReferenceNodeFix – a small fix that resolves the default behavior for nodes that were referenced from differnet .sks files. The thing is that they do not launch their animations by default, so this small hack fixes this issue

SKTexture

  • SKTexture+LinearGradient – adds a convenience initializer that generates a gradient texture for the specified size, start and end colors

SKTextureAtlas

  • SKTextureAtlas+FramesLoader – uploads an animation sequence from a texture atlas and returns an array of textures that can be futher used

SceneKit

Grand Central Dispatch

Extensions

  • DispatchQueue+DispatchOnce – adds support for class method that executes block of code only once a.k.a. DispatchOnce before Swift 3.0

Custom Types

  • Atomic – guarantees that a valid value will be returned when accessing such property by using multiple threads
  • Mutex – used to proptect shared resources. A mutex is owned by the task that takes it. In a given region of code only one thread is active
  • ReadWriteLock – a synchronization primitive that solves one of the readers–writers problems
  • UnfairLock – a lock which causes a thread trying to acquire it to simply wait in a loop ("spin") while repeatedly checking if the lock is available

WebKit

WKWebView

  • WKWebView+Load – adds support for navigating to the requested URL using String

PhotoKit

PHAsset

  • PHAsset+URL – provides possibility to get URL for image and video media types

🙋‍♀️🙋‍♂️Contributing

  • There is just one main rule for contributors – please include your extensions in separete files. It’s important since such extension can be more easily referenced and reused.
  • The other soft rule is – please include unit tests with your extensions.

👨‍💻 Author

Astemir Eleev

🔖 Licence

The project is available under MIT licence

Latest podspec

{
    "name": "extensions-kit",
    "version": "1.7.0",
    "summary": "ud83dudce6 A collection of extensions for Swift Programming Language -> 1ufe0fu20e37ufe0fu20e30ufe0fu20e3 extensions + 1ufe0fu20e39ufe0fu20e3 custom types.",
    "description": "ud83dudce6 Collection of Swift extensions(+ custom types) for various use cases. The kit contains 170 extensions + 19 custom types.",
    "homepage": "https://github.com/jVirus/extensions-kit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Astemir Eleev": "[email protected]"
    },
    "platforms": {
        "ios": "11.0"
    },
    "source": {
        "git": "https://github.com/jVirus/extensions-kit.git",
        "tag": "1.7.0"
    },
    "source_files": "extensions-kit/Extensions/**/*.swift",
    "requires_arc": true,
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "4.2"
    },
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This