You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 8, 2022. It is now read-only.
Hi there! This is an awesome project, thank you for your hard work. I've used Fuse in the past in the JavaScript world and have found a need for it in Swift, so I'm excited to use this.
I'm trying to find a way to include a FuseProperty that is an array of keywords. However, Fuse doesn't seem to acknowledge the key if it holds an array opposed to a string. Here is the code that I have:
import Cocoa
classBook:Fuseable{@objcdynamicvarname:String@objcdynamicvarauthor:String@objcdynamicvarkeywords:[String] // <- This value doesn't seem to make a different
init(author:String, name:String, keywords:[String]){self.author = author
self.name = name
self.keywords = keywords
}varproperties:[FuseProperty]{return[FuseProperty(name:"name", weight: 0.3),FuseProperty(name:"author", weight: 0.2),FuseProperty(name:"keywords", weight: 0.5) // <- Not included in the results
]}}varbooks=[Book]()letfuse=Fuse()classViewController:NSViewController{overridefunc viewDidLoad(){
super.viewDidLoad()
books.append(Book(author:"John X", name:"Old Man's War fiction", keywords:["Testing 1","Testing 2"]))
books.append(Book(author:"P.D. Mans", name:"Right Ho Jeeves", keywords:["Testing 3","Testing 4"]))letresults= fuse.search("man", in: books)
for result in results {print(result)}
// Do any additional setup after loading the view.
}overridevarrepresentedObject:Any?{
didSet {
// Update the view, if already loaded.
}}}
Is this supported in fuse-swift?
The text was updated successfully, but these errors were encountered:
I see on line 423 of Fuse.swift that the value is cast to a String, which is causing this.
Would you be open to a PR to change this behavior if the property is an array of strings? How would you like this done if so? Could it emulate the "Searching in an array of strings" method you've already created?
Hi there! This is an awesome project, thank you for your hard work. I've used Fuse in the past in the JavaScript world and have found a need for it in Swift, so I'm excited to use this.
I'm trying to find a way to include a
FuseProperty
that is an array of keywords. However, Fuse doesn't seem to acknowledge the key if it holds an array opposed to a string. Here is the code that I have:Is this supported in fuse-swift?
The text was updated successfully, but these errors were encountered: