Using Swift for iOS/Android shared libraries Tutorial

I have just finished an article about Silver. Take a look guys to make sure I didn’t get any concepts wrong. I am looking forward for your feedback and suggestions.

2 Likes

Awesome! will make sure to read and share later today!

1 Like

EUnit template is fixed for the next build, thanx!

Compiler will warn us: Nullable must be unwrapped and generate an error(E484: Cannot access members on wrapped nullable type “String?”) which it will surprisingly ignore.

you probably have “treat fixable warnings as errors” on? if so, that’s a feature, but a bug/surpeise :wink:

in Fire you cannot option+click to observe the variable type

but you can press Cmd-D or force-tap on a such-enabled trackpad?

That said, i kind go like the idea of using ° as a suffix. nice.

however aggregate sequence operations like .map, .filter produce type-erased sequences

no they don’t?

so I suggest you guys clone the SwiftBaseLibrary and modify/add APIs that you need.

or send us Pull Requests :wink:

The limitation of such container types: support for up to 8-typle which should be enough in general case.

pretty sure we support arbitrary-size tuples.

However, please note that usage of try? can unfortunately sometimes lead to compilation failures. The problem with this failure is that compiler will complain with object reference is not set to the instance of object error that will not be linked to a location in our source. If you get this error, just remember that in 90% of cases try? has caused that.

was this reported with a test case?

It’s great to explore new stuff. I never knew about Cmd-D somehow, its great it has it.
Thanks for your feedback, I will make the additions/corrections.

Its it like many of aggregate APIs are defined on Sequence extension that will return ISequence instances?

I couldn’t yet reproduce it on a sample project, yet for the codebase we were building, it was really frequent, not sure if some corner case triggers that. Do you think its kinda subjective and should not be presented in such a manner?

Right, but they will still be strongly types correctly?

Alright, I got it, my terminology is not right, type-erased sequence is what AnySequence is in Swift, it is not SequenceType. I should have said that since ISequence extensions doesn’t contain Self as return type, aggregate operations will not preserve the collection type. Will correct thanks

IMHO the whole way sequences are done in Apple Swift. its as if the whole thing was designed by someone who doesn’t understand protocols. the whole point of a sequence is that it doesn’t matter what the underlying collection type is, and that as you apply transforms such as map, the result will be lazy. :stuck_out_tongue_winking_eye:

@mh you might consider filing a proposal in swift-evolution or share your insight in swift mailing list. I am sure guys will really appreciate any insight to improve swift!

i doubt they want my feedback on to front, or that i have the energy to bring this up and discuss it :wink:

Thanks for sharing. I wonder how many of these limitations can be solved, languages like Xtend allow features like operator overloading but maybe they have it easier as they don’t target different platforms/backends like Silver does.

There are more JVM languages that have operator overloading support like the more widely used groovy and kotlin. I am sure @mh and @ck can resolve these limitations just it will require more work on elements compiler side. Good support for generics overall would have been an amazing feature for silver.

@mh: I made few corrections as you suggested.

Also toogling Treat Fixable Warnings as Errors on and off seems to have no difference. (The project with samples is available at https://github.com/ambientlight/SilverIntro)