TKAutocompletionResult

Objective-C

@interface TKAutocompletionResult : NSObject

+ (TKImage *)imageForType:(TKAutocompletionSearchIcon)type;

+ (NSUInteger)scoreBasedOnDistanceFromCoordinate:(CLLocationCoordinate2D)coordinate
                                        toRegion:(MKCoordinateRegion)coordinateRegion
                                    longDistance:(BOOL)longDistance;

/**
 0:   not match, e.g., we're missing a word
 25:  same words but wrong order
 33:  has all target words but missing a completed one
 50:  matches somewhere in the word
 66:  contains all words in right order
 75:  matches start of word in search term (but starts don't match)
 100: exact match at start
 */

+ (NSUInteger)scoreBasedOnNameMatchBetweenSearchTerm:(NSString *)searchTerm
                                           candidate:(NSString *)candidate;

+ (NSUInteger)rangedScoreForScore:(NSUInteger)score
                   betweenMinimum:(NSUInteger)minimum
                       andMaximum:(NSUInteger)maximum;

+ (NSString *)stringForScoringOfString:(NSString *)string;

@property (nonatomic, weak, nullable) id provider;
@property (nonatomic, strong) id object;

@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy, nullable) NSString *subtitle;
@property (nonatomic, strong) TKImage *image;
@property (nonatomic, strong, nullable) TKImage *accessoryButtonImage;

@property (nonatomic, strong, nullable) NSNumber *isInSupportedRegion;

/**
 A score of how this result should be ranked between 0 and 100
 
 0: probably not a good result
 25: matches only in secondary information
 50: an average match
 75: an good result matching the user input well
 100: this gotta be what the user wanted!
 */
@property (nonatomic, assign) NSInteger score;

- (NSComparisonResult)compare:(TKAutocompletionResult *)other;

@end
extension TKAutocompletionResult: Comparable

Swift

class TKAutocompletionResult : NSObject

Undocumented

  • Undocumented

    Declaration

    Objective-C

    + (TKImage *)imageForType:(TKAutocompletionSearchIcon)type;

    Swift

    class func image(forType type: TKAutocompletionSearchIcon) -> UIImage
  • Undocumented

    Declaration

    Objective-C

    + (NSUInteger)scoreBasedOnDistanceFromCoordinate:(CLLocationCoordinate2D)coordinate
                                            toRegion:(MKCoordinateRegion)coordinateRegion
                                        longDistance:(BOOL)longDistance;

    Swift

    class func scoreBasedOnDistance(from coordinate: CLLocationCoordinate2D, to coordinateRegion: MKCoordinateRegion, longDistance: Bool) -> UInt
  • 0: not match, e.g., we’re missing a word 25: same words but wrong order 33: has all target words but missing a completed one 50: matches somewhere in the word 66: contains all words in right order 75: matches start of word in search term (but starts don’t match) 100: exact match at start

    Declaration

    Objective-C

    + (NSUInteger)
        scoreBasedOnNameMatchBetweenSearchTerm:(nonnull NSString *)searchTerm
                                     candidate:(nonnull NSString *)candidate;

    Swift

    class func scoreBased(onNameMatchBetweenSearchTerm searchTerm: String, candidate: String) -> UInt
  • Undocumented

    Declaration

    Objective-C

    + (NSUInteger)rangedScoreForScore:(NSUInteger)score
                       betweenMinimum:(NSUInteger)minimum
                           andMaximum:(NSUInteger)maximum;

    Swift

    class func rangedScore(forScore score: UInt, betweenMinimum minimum: UInt, andMaximum maximum: UInt) -> UInt
  • Undocumented

    Declaration

    Objective-C

    + (NSString *)stringForScoringOfString:(NSString *)string;

    Swift

    class func stringForScoring(of string: String) -> String
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id provider

    Swift

    weak var provider: AnyObject? { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, strong) id object

    Swift

    var object: Any { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *title

    Swift

    var title: String { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *subtitle

    Swift

    var subtitle: String? { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, strong) TKImage *image

    Swift

    var image: UIImage { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) TKImage *accessoryButtonImage

    Swift

    var accessoryButtonImage: UIImage? { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSNumber *isInSupportedRegion

    Swift

    var isInSupportedRegion: NSNumber? { get set }
  • A score of how this result should be ranked between 0 and 100

    0: probably not a good result 25: matches only in secondary information 50: an average match 75: an good result matching the user input well 100: this gotta be what the user wanted!

    Declaration

    Objective-C

    @property (nonatomic) NSInteger score;

    Swift

    var score: Int { get set }
  • Undocumented

    Declaration

    Objective-C

    - (NSComparisonResult)compare:(TKAutocompletionResult *)other;

    Swift

    func compare(_ other: TKAutocompletionResult) -> ComparisonResult
  • Declaration

    Swift

    public static func < (lhs: TKAutocompletionResult, rhs: TKAutocompletionResult) -> Bool