-
Notifications
You must be signed in to change notification settings - Fork 733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support the existential any
to StoryboardType
and CVarArg
for Swift 5.6 or later.
#1056
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -75,6 +75,16 @@ import Foundation | |||||||||||||||||||||||||||||||
// MARK: - Implementation Details | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
extension {{enumName}} { | ||||||||||||||||||||||||||||||||
#if swift(>=5.6) | ||||||||||||||||||||||||||||||||
private static func tr(_ table: String, _ key: String, _ args: any CVarArg..., fallback value: String) -> String { | ||||||||||||||||||||||||||||||||
{% if param.lookupFunction %} | ||||||||||||||||||||||||||||||||
let format = {{ param.lookupFunction }}(key, table, value) | ||||||||||||||||||||||||||||||||
{% else %} | ||||||||||||||||||||||||||||||||
let format = {{param.bundle|default:"BundleToken.bundle"}}.localizedString(forKey: key, value: value, table: table) | ||||||||||||||||||||||||||||||||
{% endif %} | ||||||||||||||||||||||||||||||||
return String(format: format, locale: Locale.current, arguments: args) | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
#else | ||||||||||||||||||||||||||||||||
Comment on lines
+78
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||||||||
private static func tr(_ table: String, _ key: String, _ args: CVarArg..., fallback value: String) -> String { | ||||||||||||||||||||||||||||||||
{% if param.lookupFunction %} | ||||||||||||||||||||||||||||||||
let format = {{ param.lookupFunction }}(key, table, value) | ||||||||||||||||||||||||||||||||
|
@@ -83,6 +93,7 @@ extension {{enumName}} { | |||||||||||||||||||||||||||||||
{% endif %} | ||||||||||||||||||||||||||||||||
return String(format: format, locale: Locale.current, arguments: args) | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
#endif | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
{% if not param.bundle and not param.lookupFunction %} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it not creating a bit too much duplicated code to maintain here?
Cannot we just limit the
#if
to thefunc
line?Something more like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you that there is some strain on its maintenance. However, such a syntax is invalid in Swift.