Skip to content
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

Locale.current.currency?.identifier: Skip is unable to determine the owning type... #130

Open
djryanash opened this issue May 26, 2024 · 3 comments

Comments

@djryanash
Copy link

djryanash commented May 26, 2024

Here:

public var body: some View {
        Form {
            Section {
                TextField("Amount", value: $checkAmount, format: .currency(code: Locale.current.currency?.identifier ?? "USD"))
            }
            Section {
                Text(checkAmount, format: .currency(code: Locale.current.currency?.identifier ?? "USD"))
            }
        }
    }

I'm getting:

Skip is unable to determine the owning type for member 'currency'. This often occurs when other issues prevent Skip from matching the surrounding API call, and it may resolve when those issues are fixed. Or add the owning type explicitly (e.g. MyType.currency)

EDIT: I see that the Locale API is fully supported via SkipFoundation.

@aabewhite
Copy link
Contributor

Sorry for the trouble. It turns out that neither Text/TextField(_:, value:, format:) nor Locale.currency are supported yet. The fact that we have Locale listed as fully supported is an error. When we imported the APIs from Foundation we didn't get all the extensions, so sometimes we think we've covered the entire API when we haven't. We'll make sure to update the doc.

We do support Locale.currencySymbol, although I know that's not exactly what you want. Of course you can still use whatever you want on iOS, but you'd have to do the formatting yourself on Android. Something to the effect of:

#if !SKIP
Text(checkAmount, format: .currency(...))
#else
... Android solution ...
#endif

We'll consider this a feature request for these APIs!

@djryanash
Copy link
Author

Is "Skip is unable to determine the owning type..." a typical error for yet-to-be-supported Swift code? Are there any other errors I should be on the lookout for to determine if code has been implemented or not?

@marcprux
Copy link
Contributor

Is "Skip is unable to determine the owning type..." a typical error for yet-to-be-supported Swift code? Are there any other errors I should be on the lookout for to determine if code has been implemented or not?

Generally speaking, we try to mark missing API as unavailable in SKIP, which will raise a clearer error:

This API is not yet available in Skip.
Consider placing it within a #if !SKIP block.

We have fairly good coverage of this in SkipUI, but SkipFoundation is still missing a number of them. In these cases, you'll either see the "Skip is unable to determine the owning type..." error, or else simply a "Missing type" error from the Kotlin compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants