Skip to content

Commit 3e2e985

Browse files
authored
Merge pull request #24 from what3words/staging
Staging to Main
2 parents 7fe8769 + 2bf417d commit 3e2e985

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

Sources/W3WSwiftCore/Localization/W3WTranslationsProtocol.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,18 @@ public extension W3WTranslationsProtocol {
2727
func get(id: String) -> String {
2828
return get(id: id, language: nil)
2929
}
30-
30+
}
31+
32+
33+
public extension W3WTranslationsProtocol {
34+
/// Returns a localized, formatted string for the given translation id using the provided arguments.
35+
///
36+
/// - Parameters:
37+
/// - id: The translation id or key to look up.
38+
/// - arguments: Values to substitute into the localized string using `String(format:)`-style formatting.
39+
/// - Returns: A formatted localized string with arguments inserted.
40+
func get(id: String, _ arguments: CVarArg...) -> String {
41+
let localized = get(id: id)
42+
return String(format: localized, arguments)
43+
}
3144
}

Sources/W3WSwiftCore/Reactive/W3WEventSubscriberProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public protocol W3WEventSubscriberProtocol: AnyObject {
2121
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
2222
public extension W3WEventSubscriberProtocol {
2323

24-
@discardableResult func subscribe<EventType: Subject>(to: EventType?, handler: @escaping (EventType.Output) -> ()) -> AnyCancellable? {
24+
@discardableResult func subscribe<EventType: Publisher>(to: EventType?, handler: @escaping (EventType.Output) -> ()) -> AnyCancellable? {
2525
let subscription = to?.sink(
2626
receiveCompletion: { _ in },
2727
receiveValue: { event in

0 commit comments

Comments
 (0)