Latest 2.0.5
Homepage https://github.com/ViacomInc/ViaSwiftUtils
License Apache License, Version 2.0
Platforms ios 9.0, watchos 2.0, tvos 9.0, requires ARC
Authors

Swift 4.1
Carthage compatible
Version
Platform
Build Status
License

What can ViaSwiftUtils do for you? Here are some examples we compiled:

Tired of spelling out NSLocalizedString every time you localize a string?

title = "HomePage.title".localized
print(title) // 'Main', '頭版', 'صفحه نخست', 'Startseite'

Want to find the longest word in a string?

print(germanText.longestWord())
// 'Verkehrsinfrastrukturfinanzierungsgesellschaft'

Need an array (or any other MutableCollection) shuffled? [^3]

var numbers = [1, 2, 3, 4, 5, 6]
numbers.shuffleInPlace() //e.g. [4, 1, 5, 2, 6, 3]

Want all the unique entries in a Sequence with Hashable elements?

let emojis = ["😀", "👀", "😱", "😡", "👀", "😀", "👀", "😱"]
let uniqueEmojis = emojis.unique() // ["😀", "👀", "😱", "😡"]

Is dealing with TimeInterval inconvenient?

let twelveDays = 12 * TimeInterval.day
let minutes = twelveDays / TimeInterval.minute // 17280

Need to create an image with rounded corners from an existing image?

Rounded image


Does one of the views in your app need to rotate?

someView.startRotating()
// ...
someView.stopRotating()

And more date helper methods & variables:

let components = DateComponents(calendar: gregorian, era: 0,
                                year: 44, month: 3, day: 15, hour: 13)
let idesOfMarch = gregorian.date(from: components)!
let weekDay = idesOfMarch.dayOfWeek // 6
let daysSince = idesOfMarch.days(to: Date()) // 752533

 

These are just a few examples. We are expanding the library continuously and we accept Pull-Requests ☺️

 

How to install ViaSwiftUtils

 

Via Cocoapods

Add the following line to your Podfile.
Remember you’ll need to enable use_frameworks!.

pod 'ViaSwiftUtils', '1.0.2'

Via Carthage

Add the following line to your Cartfile

github "ViacomInc/ViaSwiftUtils" ~> 1.0.2

Via Swift package manager

Add the following to your Package.swift dependencies

.Package(url: "https://github.com/ViacomInc/ViaSwiftUtils", majorVersion: 1, minor: 0),

I should mention that only the Foundation functions that are part of ViaSwiftUtils work via SPM, as UIKit is not available on Linux or MacOS.

Importing

After you installed the framework via one of the 3 above methods, import it in your .swift file.

import ViaSwiftUtils

 

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Latest podspec

{
    "name": "ViaSwiftUtils",
    "version": "2.0.5",
    "summary": "Swift Utilities written with and for Viacom Inc.",
    "description": "Goodie box of small helper functions/extensions used in many Swift Apps at Viacom",
    "homepage": "https://github.com/ViacomInc/ViaSwiftUtils",
    "license": {
        "type": "Apache License, Version 2.0"
    },
    "authors": {
        "Konrad Feiler": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ViacomInc/ViaSwiftUtils.git",
        "tag": "2.0.5"
    },
    "platforms": {
        "ios": "9.0",
        "watchos": "2.0",
        "tvos": "9.0"
    },
    "requires_arc": true,
    "ios": {
        "source_files": "Sources/ViaSwiftUtils/**/*"
    },
    "osx": {
        "source_files": "Sources/ViaSwiftUtils/Foundation/*"
    },
    "watchos": {
        "source_files": "Sources/ViaSwiftUtils/Foundation/*"
    },
    "tvos": {
        "source_files": "Sources/ViaSwiftUtils/Foundation/*"
    }
}

Pin It on Pinterest

Share This