Latest 1.0.1
Homepage https://github.com/mabidakun/StringSearchKit
License MIT
Platforms osx 10.11, ios 8.0, tvos 9.0
Authors

A simple library for macOS/iOS/tvOS – enabling fast, in memory, prefix based, string searching, using a Trie.

CI Status
Version
License
Platform

Requirements

  • macOS 10.11+
  • iOS 8+
  • tvOS 9+

Installation

StringSearchKit is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "StringSearchKit"

Why is this framework useful?

Because it makes it really easy to implement Auto-Complete functionality in an application – as I did in my macOS™ app – Sequence Diagram

How do I get started?

Usage:

  • StringDictionary(withStrings: [String], preserveCase: Bool = false)
  • StringDictionary(withTextFileNamed: <A name of a text file in your Bundle>, preserveCase: Bool = false)
  • StringDictionary(withTextFilepath: <The path to a text file>), preserveCase: Bool = false

Using one of the initialisers above, create an instance of StringDictionary.

When initialising from a file, it should simply contain one string per-line.

Strings are not limited to being single words – but are in the examples, for simplicity.

Example file contents :-

act
apologise
apology
app
apple

Once instantiated, use the StringDictionary to quickly find strings (case-insensitively) with a given prefix.

let stringDictionary = StringDictionary(withStrings: ["act", "app", "apple", "apologise", "apology"])
let searchResults = stringDictionary.strings(withPrefix: "app")

// searchResults will then contain ["app", "apple"]

Search Result Case Preservation

If you set preserveCase: true in any of the init methods (default is false for backwards compatibility), the results will be returned in the same case that the original words were in when added.

For example:

let stringDictionary = StringDictionary(withStrings: ["Act", "App", "Apple", "Apologise", "Apology"], preserveCase: true)
let searchResults = stringDictionary.strings(withPrefix: "app")

// searchResults will then contain ["App", "Apple"]

Author

Mike O. Abidakun [email protected]

License

StringSearchKit is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "StringSearchKit",
    "version": "1.0.1",
    "summary": "A simple library for macOS/iOS/tvOS - enabling fast, in memory, prefix based, string searching, using a Trie.",
    "description": "A simple library for macOS/iOS/tvOS that enables fast, in memory, prefix based, string searching using a Trie data strucutre.",
    "homepage": "https://github.com/mabidakun/StringSearchKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "mabidakun": "[email protected]"
    },
    "source": {
        "git": "https://github.com/mabidakun/StringSearchKit.git",
        "tag": "1.0.1"
    },
    "platforms": {
        "osx": "10.11",
        "ios": "8.0",
        "tvos": "9.0"
    },
    "source_files": "StringSearchKit/Classes/**/*"
}

Pin It on Pinterest

Share This