krisk / fuse-swift

A lightweight fuzzy-search library, with zero dependencies
MIT License
931 stars 110 forks source link

Struct support #20

Closed StevenSorial closed 4 years ago

StevenSorial commented 5 years ago

I don't know if there is a performance penalty to structs support or not, so I used it as a last resort if the original implementation failed.

krisk commented 5 years ago

Nice. Could you also add some tests to Tests.swift?

StevenSorial commented 5 years ago

Sure. if you don't mind me asking, what was achieved by using

let object = item as AnyObject
..
let selector = Selector(property.name)
let value = object.perform(selector).takeUnretainedValue() as? String

vs simply

let value = item.name
StevenSorial commented 5 years ago

I have ditched reflection for a simple property accessing to support more use cases. it shouldn't be a performance issue given Swift Copy-On-Write. This is a breaking change for Fuseable users, but it should be a simple one. Tests and Docs are updated accordingly.

StevenSorial commented 5 years ago

@krisk

mthole-old commented 4 years ago

Good stuff here, thanks @StevenMagdy !

StevenSorial commented 4 years ago

The branch is updated to reflect the latest changes. I hope it will be merged one day 🙏