iDevKits 1.0.3

iDevKits 1.0.3

Maintained by Nghia Nguyen.



iDevKits 1.0.3

  • By
  • quangnghiadev

Build Status Cocoapods platforms Cocoapods SPM compatible Swift Xcode MIT

iDevKits is a composited library of useful classes, extensions for helping development more fastly

Requirements

  • iOS 11.0+
  • Swift 5.0+

Installation

CocoaPods

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

pod 'iDevKits'                  //  Integrate all
// or
pod 'iDevKits/SafeDictionary'   //  Integrate Safe Dictionary only
pod 'iDevKits/UserDefault'      //  Integrate User Default only
pod 'iDevKits/Foundation'       //  Integrate Foundation only
pod 'iDevKits/UIKit'            //  Integrate UIKit only

Swift Package Manager

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

import PackageDescription

let package = Package(
    name: "YOUR_PROJECT_NAME",
    targets: [],
    dependencies: [
        .package(url: "https://github.com/nghiadev95/iDevKits.git", from: "1.0.0")
    ]
)

Usage

Safe Dictionary

Using this class for safe access dictionary value when working with multi thread

let safeDictionary = SafeDictionary<String, Int>(queueLabel: "queue.name")

/// Get value from key
let id = safeDictionary["id"]
// or
let id = safeDictionary.getValue(key: "id")

/// Update value for key
safeDictionary.updateValue(2, forKey: "id")
// or
safeDictionary["id"] = 2

/// Remove value with key
safeDictionary.removeValue(forKey: "id")

/// Get all keys
let keys = safeDictionary.keys

/// Remove all element with keeping capacity ability
safeDictionary.removeAll()
safeDictionary.removeAll(keepingCapacity: true)

User Default

Property Wrapper of User Default

/// Saving primitive data type
@UserDefaultVariable(key: "accessToken", defaultValue: nil)
var accessToken: String?

/// Saving custom Codable object
@UserDefaultObject(key: "user")
var user: UserProfile?

Extension

License

  • iDevKits is released under the MIT license. See LICENSE for more information.