A Swift package that provides a Trie data structure that allow efficient searches of values that map from prefixed keys or non-prefixed key substrings.
- Swift 5.8
SwiftTrie can be integrated as an Xcode project target or a Swift package target.
- Go to
File
->Add Package Dependencies
. - Type https://github.com/tyiu/swift-trie.git into the search field.
- Select
swift-trie
from the search results. - Select
Up to Next Major Version
starting from the latest release as the dependency rule. - Ensure your project is selected next to
Add to Project
. - Click
Add Package
. - On the package product dialog, add
SwiftTrie
to your target and clickAdd Package
.
In your Package.swift
file:
- Add the SwiftTrie package dependency to https://github.com/tyiu/swift-trie.git
- Add
SwiftTrie
as a dependency on the targets that need to use the SDK.
let package = Package(
// ...
dependencies: [
// ...
.package(url: "https://github.com/tyiu/swift-trie.git", .upToNextMajor(from: "0.1.0"))
],
targets: [
.target(
// ...
dependencies: ["SwiftTrie"]
),
.testTarget(
// ...
dependencies: ["SwiftTrie"]
)
]
)
See TrieTests.swift for an example of how to use SwiftTrie.