← 输入框|github.com|刷新
Skip to content

About

Useful Swift development helper kit.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Latest commit

 

History

25 Commits

Folders and files

Repository files navigation

DevelopmentKit

Swift Version License

DevelopmentKit is a lightweight, easy-to-use framework for iOS development, making it simple to add powerful features to your app with just a few lines of code. The framework is written in Swift and designed to work seamlessly with UIKit.

p.s. I will be adding more features as well as tests and documentation in future releases.

Requirements

  • iOS 14.0+
  • Xcode 12+
  • Swift 5.3+

Installation

Xcode Project Setup

Select File → Add Packages, then enter the repository URL:

https://github.com/MarkoAntoljak/DevelopmentKit.git

Then select the version and add it to your project.

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. To integrate DevelopmentKit into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'DevelopmentKit', :git => 'https://github.com/MarkoAntoljak/DevelopmentKit.git'

Then, run the following command: $ pod install

Swift Package Manager

Add this to your Package.swift:

dependencies: [
  .package(url: "https://github.com/MarkoAntoljak/DevelopmentKit.git", from: "1.0.1")
]

Usage Examples

Phone Number Input

import DevelopmentKit

let phoneTextField = DKPhoneNumberTextField(
    prefix: "1",
    flag: "🇺🇸",
    placeholder: "Enter phone number"
)
phoneTextField.countryDelegate = self

// Access the full phone number with country code
if let fullNumber = phoneTextField.fullPhoneNumber {
    print(fullNumber) // Output: +1234567890
}

SMS Code Input

let codeField = DKCodeSMSTextField(
    placeholderCharacter: "-",
    codeCount: 6
)

codeField.didEnterLastDigit = { code in
    print("Code entered: \(code)")
}

Logging

DKLogger.log(.info, "Application started")
DKLogger.log(.error, "An error occurred")
DKLogger.logAnalytics("user_signup")

Date Operations

// Convert date to string
let dateString = Date().asString(.shortAmericanWithTime)

// Convert string to date
let date = "2024-12-13".getDate()

// Get time ago
let timeString = Date().timeAgo() // "Just now", "2 hours ago"

Country Management

// Get current user's country
if let userCountry = CountryRepository.shared.getUserCountry() {
    print("User country: \(userCountry.name) \(userCountry.flag)")
}

// Get all countries
let allCountries = CountryRepository.shared.getCountries()

UI Reactivity

// Add touch animation to button
button.addButtonReactivity()

// Add touch animation to view
view.addViewReactivity()

// Animate border width
view.animateBorderWidth(toValue: 2.0, duration: 0.3)

String & Number Utilities

// String manipulation
let substring = "Hello World"[0..<5] // "Hello"
let trimmed = "  text  ".trimmed() // "text"
let isValid = "user@email.com".isValidEmail() // true

// Number conversion
let numberString = 42.toString
let intValue = "100".toInt // 100

License

DevelopmentKit is released under the MIT license. See LICENSE for details.

About

Useful Swift development helper kit.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages