Is this Unresolved reference 'insert' on the String struct because of SKIP? #195
-
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
As you point out in the reference to https://skip.tools/docs/modules/skip-lib/#swift-standard-library-support, Kotlin strings are not mutable, and so we cannot support functions like
|
Beta Was this translation helpful? Give feedback.
-
Hey Marc, @marcprux , as I've pondered this issue a while now, it is not making sense to me. Swift Strings are also non-mutable and yet the Swift Lib allows many functions that mutate the original String. I believe the Kotlin library does a very similar trick. They return a new string upon "write". This would be very similar to how the capitalized computed property works. And how the function trimmingCharacters(in set: CharacterSet) -> String works. So since I've got an App that is going to need a few String mutating functions... I guess I have to write them myself. OK... is there a way I could contribute this code to the SKIP project... if it was of high quality/robustness? Do you have ANY suggestion for how to start .... |
Beta Was this translation helpful? Give feedback.
-
Functions like |
Beta Was this translation helpful? Give feedback.
-
Still seeking understanding @marcprux, Docs said: "The following table summarizes SkipLib’s Swift Standard Library API support on Android. Anything not listed here is likely not supported. Note that in your iOS-only code - i.e. code within #if !SKIP blocks - you can use any API you want." I see that in Skip-Lib the Collection contains: And does String implement Collection as a protocol? Or maybe NOT??? Should I be looking to cast my String to a Collection? So that I can use the insert method? |
Beta Was this translation helpful? Give feedback.
As you point out in the reference to https://skip.tools/docs/modules/skip-lib/#swift-standard-library-support, Kotlin strings are not mutable, and so we cannot support functions like
insert
. The workaround is to do something like: