Swiftpack.co - GoodRequest/GoodSwift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by GoodRequest.
GoodRequest/GoodSwift 0.10.0
Some good swift extensions, handfully crafted by GoodRequest team.
⭐️ 6
🕓 1 week ago
.package(url: "https://github.com/GoodRequest/GoodSwift.git", from: "0.10.0")


Version License Platform

Some good swift extensions, handfully crafted by GoodRequest team.


  • iOS 10.0+
  • Xcode 10.0+
  • Swift 4.2 (for Swift 4.0 use version 0.9.0)


.goodswift is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'GoodSwift'



.goodswift allows you to easily decode JSON objects from Alamofire responses using Unbox decoder. You can see examples how to map your model in Unbox readme.

import Unbox

struct Foo {
    let origin: String
    let url:    URL

extension Foo: Unboxable {
    init(unboxer: Unboxer) throws {
        self.origin = try unboxer.unbox(key: "origin")
        self.url = try unboxer.unbox(key: "url")

Then you just need to use unbox or unboxArray functions to decode your model.

import Alamofire
import GoodSwift

Alamofire.request("https://httpbin.org/get").unbox(completion: { (response: DataResponse<Foo>) in
    switch response.result {
    case .success(let foo):
        // Decoded object
    case .failure(let error):
        // Handle error


Automatic logging is enabled when there is Active Compilation Conditions flag DEBUG defined in project's Build Settings. If you have added .goodswift using CocoaPods you need to add flag DEBUG manually into Active Compilation Conditions in .goodswift pod Build Settings. If you don't want to add this flag manually after each pod install you just need to add this script at the end of your Podfile.

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == 'GoodSwift'
            target.build_configurations.each do |config|
                if config.name == 'Debug'
                    config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = 'DEBUG'
                    config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = ''

Log level

You can choose logging level by setting logLevel static variable from DataRequest class. For now you can choose from these logging levels:

  • error - prints only when error occurs
  • info (default) - prints request url with response status and error when occurs
  • verbose - prints everything including request body and response object

Chain animations

AnimationChain allows you to easily chain UIView animations:

UIView.animationChain.animate(withDuration: 2) {
    view.alpha = 0.0
}.animate(withDuration: 2) {
    view.alpha = 1.0
}.start {
    debugPrint("Animation finished")

LinkedList implementation

.goodswift allows you to use default implementation of LinkedList (Queue, FIFO). Wiki

let queue = LinkedList<Int>()

print(queue.isEmpty)            // true

queue.push(1)                   // [1]
queue.push(2)                   // [1, 2]
queue.push(3)                   // [1, 2, 3]

print(queue.contains(1))        // true
print(queue.filter { $0 > 1 })  // [2, 3]
print(queue.map { $0 + 2 })     // [3, 4, 5]
print(queue.pop())              // Optional(1)
print(queue.pop())              // Optional(2)
print(queue.isEmpty)            // false
print(queue.peak())             // Optional(3)
print(queue.pop())              // Optional(3)
print(queue.isEmpty)            // true


Marek Spalek, marek.spalek@goodrequest.com


Pavol Kmet, pavol.kmet@goodrequest.com

Tomas Gibas, tomas.gibas@goodrequest.com

Dominik Petho, dominik.petho@goodrequest.com

Filip Sasala, filip.sasala@goodrequest.com


.goodswift is available under the MIT license. See the LICENSE file for more info.


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

Release Notes

1 week ago

Bump to Alamofire 5, fix SPM compatibility

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