Swiftpack.co - ViacomInc/ViaSwiftUtils as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ViacomInc.
ViacomInc/ViaSwiftUtils 2.1.0
Utilities for Building Applications in Swift
⭐️ 23
🕓 3 weeks ago
.package(url: "https://github.com/ViacomInc/ViaSwiftUtils.git", from: "2.1.0")


Swift 5.0 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?

// '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?

// ...

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 ☺️



Versions support

Swift Xcode ViaSwiftUtils
4.2 - 5.0 10.X, 11.X 2.1.0
4.0 10.X 2.0.5
3.2 - 4.1 9.X 2.0.5


How to install ViaSwiftUtils

Via Cocoapods

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

pod 'ViaSwiftUtils', '2.1.0'

Via Carthage

Add the following line to your Cartfile

github "ViacomInc/ViaSwiftUtils" == 2.1.0

Via Swift package manager

Add the following to your Package.swift

dependencies: [
  .package(url: "https://github.com/ViacomInc/ViaSwiftUtils.git", .exact("2.1.0")),

.target(name: <#yourTarget#>, dependencies: ["ViaSwiftUtils"]),

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.


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

import ViaSwiftUtils



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


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.


Stars: 23
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

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