Swiftpack.co - Package - nghiadev95/DevelopKits

Build Status Cocoapods platforms Cocoapods SPM compatible Swift Xcode MIT

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

Requirements

  • iOS 11.0+
  • Swift 5.0+

Installation

CocoaPods

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

pod 'DevelopKits'

Swift Package Manager

You can use The Swift Package Manager to install DevelopKits 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/DevelopKits.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?

Then

let label = UILabel().then {
    $0.textAlignment = .center
    $0.textColor = UIColor.black
    $0.text = "Hello, World!"
}

Extension

License

  • DevelopKits is using Then. See LICENSE for more information.
  • DevelopKits is released under the MIT license. See LICENSE for more information.

Github

link
Stars: 0

Dependencies

Used By

Total: 0

Releases

- 2020-08-30 09:40:42

- 2020-08-22 09:43:54

- 2020-08-18 15:36:29

Beta - 2020-08-15 15:02:52

Alpha - 2020-08-15 05:49:23