This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (NSString*)localizedRelativeTime { | |
| NSDateComponentsFormatter *formatter = [[NSDateComponentsFormatter alloc] init]; | |
| formatter.allowedUnits = NSCalendarUnitHour | NSCalendarUnitMinute; | |
| formatter.unitsStyle = NSDateComponentsFormatterUnitsStyleShort; | |
| if (self.timeIntervalSinceNow < 60 && self.timeIntervalSinceNow > -60) { | |
| return NSLocalizedString(@"right now", @"from MapKit/Maps"); | |
| } else if (self.timeIntervalSinceNow > 0) { | |
| NSString *start = [formatter stringFromDate:NSDate.date toDate:self]; | |
| return [NSString stringWithFormat:NSLocalizedString(@"in %@", @"placeholder: minutes/hours"), start]; | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Maps.app uses its own custom marker annotations. Their icon is smaller (FB10143146), the title can be colored (FB9739380) | |
| which is all pretty nice. Unfortunately, they’re not exposed as API. (Hence the feedbacks to expose them.) | |
| Out of curiosity, I tried to hack around with MapKit to display them. Unfortunately, I didn’t succeed. Here’s what I tried: | |
| I discovered _MKBalloonLabelMarkerView and its superclass _MKLabelMarkerView which might be the ones I’m looking for | |
| (I might be wrong). | |
| We can instantiate them using: |
OlderNewer