SwifterSwift travis-ci SwiftPM CocoaPods

A handy collection of more than 500 native Swift 3 extensions to boost your productivity.

Build Status Cocoapods Carthage compatible codecov CocoaPods CocoaPods Platform Swift Xcode MIT

SwifterSwift is a collection of over 500 native Swift 3 extensions, with handy methods, syntactic sugar, and performance improvements for wide range of primitive data types, UIKit and Cocoa classes –over 500 in 1– for iOS, macOS, tvOS and watchOS.

Whats New in v1.6.4?

v1.6.4 brings new extensions, improved tests and minor bug fixes


  • iOS 8.0+ / tvOS 9.0+ / watchOS 3+ / macOS 10.10+
  • Xcode 8.1+
  • Swift 3.0+



CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate SwifterSwift into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target '<Your Target Name>' do
    pod 'SwifterSwift'

Then, run the following command:

$ pod install


Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate SwifterSwift into your Xcode project using Carthage, specify it in your Cartfile:

github "SwifterSwift/SwifterSwift" ~> 1.5

Run carthage update to build the framework and drag the built SwifterSwift.framework into your Xcode project.

Swift Package Manager

You can use The Swift Package Manager to install SwifterSwift by adding the proper description to your Package.swift file:

import PackageDescription

let package = Package(
    name: "YOUR_PROJECT_NAME",
    targets: [],
    dependencies: [
        .Package(url: "https://github.com/SwifterSwift/SwifterSwift.git", majorVersion: 1),

Note that the Swift Package Manager is still in early design and development, for more information checkout its GitHub Page


Add the extensions folder to your Xcode project to use all extensions, or a specific extension.

Read the Full Documentation

Full documentation with code examples is available in the Docs repo

List of Extensions

List of UIKit Extensions

List of Cocoa Extensions

How cool is this?

SwifterSwift is a library of over 500 properties and methods, designed to extend Swift's functionality and productivity, staying faithful to the original API design guidelines of Swift 3.

Here are some examples:

Array Extensions:

// Remove duplicates from an array
[1, 2, 3, 1, 3].removeDuplicates() -> [1, 2, 3]

// Return all indexes of specified item
["h", "e", "l", "l", "o"].indexes(of: "l") -> [2, 3]

// Shuffle an array
["h", "e", "l", "l", "o"].shuffled = ["e", "l", "o", "l", "h"]

// Return random item from an array
[1, 2, 3, 4, 5].randomItem -> 3

// and many others!

Check All Array Extensions!

Date Extensions:

// Get and set components from date with ease
date.hour = 14

// Check if date is in today
Date().isInToday -> true

// Add 1 month to current date
Date().add(.month, value: 1)

// Return date at the beginning of current day
Date().beginning(of: .day)

// Return date at the end of current month
Date().end(of: .month)

// Check if date is in current calendar unit
Date().isInCurrent(.month) -> true

// Return iso8601 string for date
Date().iso8601String -> "2016-08-23T21:26:15.287Z"

// Create date from iso8601 string
let date = Date(iso8601String: "2016-08-23T21:26:15.287Z")

// Create date from DateComponents
let date = Date(year: 2016, month: 8, day: 15) // other components set to current
let date = Date(hour: 9, minute: 18, second: 1) // other components set to current

// Represent date as a string with ease
Date().dateString(ofStyle: .medium) -> "Aug 26, 2016"
Date().timeString(ofStyle: .short) -> "12:55 AM"
Date().dateTimeString() -> "Aug 26, 2016, 12:55:24 AM"

// Get day name or month name from a date
Date().dayName(ofStyle: .full) -> "Sunday"
Date().monthName(ofStyle: .threeLetters) -> "Dec"

// and many others!

Check All Date Extensions!

String Extensions:

// Return count of substring in string
"hello world".count(of "o", caseSensitive: false) -> 2

// Return an array of strings separated by given string
"hello world".split(by: " ") -> ["hello", "world"]

// Return string with no spaces or new lines in beginning and end
"\n Hello   ".trimmed -> "Hello"

// Return most common character in string
"swifterSwift is making swift more swifty".mostCommonCharacter -> "i"

// Returns CamelCase of string
"Some variable nAme".camelCased -> "someVariableName"

// Check if string is in valid email format
"[email protected]".isEmail -> true

// Check if string contains at least one letter and one number
"123abc".isAlphaNumeric -> true

// Reverse string
"123abc".reverse() -> "cba321"

// Return latinized string
"Hèllö Wórld!".latinize() -> "Hello World!"

// Create random string of length
String.random(ofLength: 10) -> "AhEju28kNl"

// Check if string contains one or more instance of substring
"Hello World!".contain("o", caseSensitive: false) -> true

// Check if string contains one or more emojis

Related Repositories



Documentation for SwifterSwift. ...



SwifterSwift for Linux ...

Top Contributors

omaralbeik SD10 LucianoPAlmeida pawurb pvtmert basememara tapanprakasht tache ecylo joerocca ythecombinator thedabbour xingfuqiu emiroks flashspys FrankKair gperdomor hujunfeng Quaggie ronanrodrigo sairamkotha ShivaHuang gitter-badger yhwinnie mudox king6cong wousser


-   v1.6.2 zip tar
-   v1.6.1 zip tar
-   v1.6 zip tar
-   v1.5 zip tar
-   v1.4.8 zip tar
-   v1.4.7 zip tar
-   v1.4.6 zip tar
-   v1.4.5 zip tar
-   v1.4.4 zip tar
-   v1.4.3 zip tar
-   v1.4.2 zip tar
-   v1.4.1 zip tar
-   v1.4 zip tar
-   v1.3.9 zip tar
-   v1.3.8 zip tar
-   v1.3.7 zip tar
-   v1.3.6 zip tar
-   v1.3.5 zip tar
-   v1.3.4 zip tar
-   v1.3.2 zip tar
-   v1.3.1 zip tar
-   v1.3 zip tar
-   v1.2.2 zip tar
-   v1.2.1 zip tar
-   v1.1 zip tar
-   v1.0.4 zip tar
-   v1.0.3 zip tar
-   v1.0.2 zip tar
-   v1.0.1 zip tar
-   v1.0.0 zip tar