Post

Replies

Boosts

Views

Activity

Reply to Get the word "Month", "Day", "Week" localized
Following up my previous comment (still being approved) A more type-safe version: enum UnitSymbol: String { case month case week case day } func localizedUnit(for unitSymbol: UnitSymbol, locale: Locale) -> String { let numberFormatter = NumberFormatter() numberFormatter.notANumberSymbol = "" let formatter = MeasurementFormatter() formatter.unitStyle = .long formatter.numberFormatter = numberFormatter formatter.locale = locale return formatter.string(from: Measurement(value: .nan, unit: Unit(symbol: unitSymbol.rawValue))) }
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’24
Reply to Get the word "Month", "Day", "Week" localized
I managed to do it using this: func localizedUnit(for unit: Unit, locale: Locale) -> String { let numberFormatter = NumberFormatter() numberFormatter.notANumberSymbol = "" let formatter = MeasurementFormatter() formatter.unitStyle = .long formatter.numberFormatter = numberFormatter formatter.locale = locale return formatter.string(from: Measurement(value: .nan, unit: unit)) }
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’24
Reply to Get the word "Month", "Day", "Week" localized
Following up my previous comment (still being approved) A more type-safe version: enum UnitSymbol: String { case month case week case day } func localizedUnit(for unitSymbol: UnitSymbol, locale: Locale) -> String { let numberFormatter = NumberFormatter() numberFormatter.notANumberSymbol = "" let formatter = MeasurementFormatter() formatter.unitStyle = .long formatter.numberFormatter = numberFormatter formatter.locale = locale return formatter.string(from: Measurement(value: .nan, unit: Unit(symbol: unitSymbol.rawValue))) }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’24
Reply to Get the word "Month", "Day", "Week" localized
I managed to do it using this: func localizedUnit(for unit: Unit, locale: Locale) -> String { let numberFormatter = NumberFormatter() numberFormatter.notANumberSymbol = "" let formatter = MeasurementFormatter() formatter.unitStyle = .long formatter.numberFormatter = numberFormatter formatter.locale = locale return formatter.string(from: Measurement(value: .nan, unit: unit)) }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’24
Reply to iOS 15 - "Keep..." button in provisional user notifications doesn't save the settings
Hey guys, isn't there any solution to this yet? I can't find any more information about this problem. Provisional notifications are useless to me, right now.
Replies
Boosts
Views
Activity
Jun ’23
Reply to macOS UI Test: Can't find popover in elements tree
I just solved it! 🙌🏻 NSApp.setAccessibilityChildren([view])
Replies
Boosts
Views
Activity
Jul ’21
Reply to macOS UI Test: Can't find popover in elements tree
I have exactly the same problem 😞
Replies
Boosts
Views
Activity
Jul ’21