- iOS 13.0+ / macOS 11.5+ / watchOS 6.0+ / tvOS 13.0+
- Xcode 16.4+
- Swift 5.9+
structUser:Codable{varid:Intvarname:String}
// Encode to URL query
letuser=User(id:123, name:"Neo")letquery=tryURLQueryEncoder().encode(user)
// Decode from URL query
letquery="id=123&name=Neo"letuser=tryURLQueryDecoder().decode(User.self, from: query)The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
To integrate URLQueryCoder into your Xcode project using Swift Package Manager,
add the following as a dependency to your Package.swift:
.package(url:"https://github.com/almazrafi/URLQueryCoder.git", from:"1.3.0")and then specify "URLQueryCoder" as a dependency of the Target in which you wish to use URLQueryCoder.
Here's an example Package.swift:
// swift-tools-version:5.9
import PackageDescription
letpackage=Package(
name:"MyPackage",
products:[.library(name:"MyPackage", targets:["MyPackage"])],
dependencies:[.package(url:"https://github.com/almazrafi/URLQueryCoder.git", from:"1.3.0")],
targets:[.target(name:"MyPackage", dependencies:["URLQueryCoder"])])Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthageTo integrate URLQueryCoder into your Xcode project using Carthage, specify it in your Cartfile:
github "almazrafi/URLQueryCoder" ~> 1.3.0
Finally run carthage update to build the framework and drag the built URLQueryCoder.framework into your Xcode project.
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapodsTo integrate URLQueryCoder into your Xcode project using CocoaPods, specify it in your Podfile:
platform:ios,'13.0'use_frameworks!target'<Your Target Name>'dopod'URLQueryCoder'endFinally run the following command:
$ pod install- If you need help, open an issue.
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
URLQueryCoder is available under the MIT license. See the LICENSE file for more info.