Build share library with Sliver for multi platform

I am doing a POC on Silver to see if it can be beneficial to deploy our iOS native Swift App on other Platform.
I try to build a cross-platform static library with Silver by shipping those code written with Swift on Xcode to Silver. I had created one Shared project and three different platforms library project. Then I try my best afford to fix those syntax error on Fire.

However, I am defeated by the following issues:

Array count is not support on Android
Array count is okay for Cocoa. but it is not compilable when try to compile for Android project.

protocol is not well support on Cocoa
In Silver:

protocol FormatHelperProtocol {
	func formatCurrency(amount: Double) -> String
	func formatCurrency(amount: Double, fractionDigits: Int) -> String
}

In the library header of .a , it just have a empty protocol

@protocol FormatHelperProtocol
@end 

I had tried put public on the method of protocol to Silver, but it is not compilable on Silver. I think it is just not a valid syntax :stuck_out_tongue:

Sugar.reflection on Cocoa
I am not sure if the reflection in Sugar is trying to handle the reflection of the class, i.e. I can get all the property names in a given class by that. But it seems not work for Silver on Cocoa at the moment.

Sugar.Data.JSON for all Platform
Similar to the reflection, it seems also not completed for Silver. right :question:

Besides the above, I also got the problems mentioned at
http://talk.remobjects.com/t/issue-on-sugar-datetime/6365

http://talk.remobjects.com/t/nsobject-is-an-unknown-identifier-on-swift-net-console-app/5834

I don’t know if I miss any thing. May be there are other work arround,
I know Sugar, Silver and Fire are all on beta now. I just wish the above can be aware by you. :smile: and waiting for your next release. And looking forward the integration of Swift 2.0.

Sam

Can you give me a code sample or more context? Swift arrays should support count. The platform-native away/list classes on the various platforms might have different names (*such as Length, etc).

are the functions only missing from the header, or do you also not see them in your code from within your Silver project?

If you could send me your complete project that shows all these issues,that would be super helpful in helping us narrow these down.

That code is incomplete should never have shipped, and i apologize for that. The latest version of Sugar on GitHub (and in the upcoming next build) has a full/proper cross-platform JSON implementation in the core Sugar library. Please let me know how this works out for you.

Hmm. the Swift Base Library should define NSObject as an alias to the system object types in .NET and Java. Are you sure you have the Swift reference in your project?

public typealias NSObject = Object

Sund sike that too would be caused by the Swift library not being references )and it this not finding either NSObject (on .NET and Java) nor AnyObject on any of the three platforms, coz AnyObject is specific to Swift and not a general Cocoa type name).

We’re hard at work on that. Some exciting new stuff in Swift 2.0. :wink:

Thanks so much for your quick responds! That raise my confidence on Silver.

I had modify my quotation, it is only not work when I try to compile the source (in Silver) on my Android library project. All the .count highlighted with red

the Code I writen in Silver is just like I posted here

protocol FormatHelperProtocol {
    func formatCurrency(amount: Double) -> String
    func formatCurrency(amount: Double, fractionDigits: Int) -> String
}

We use protocol mechanism to let the Silver Library calling the platform specific code that handle what Silver can’t do.

I saw the Source of the Sugar for Json. I am looking for the release of next build. :smiley:

For the Reflection and DateTime, I have check the latest Git source of Sugar, it seems still not support Cocoa (DateTime for Android too), right?

Thanks so much! You are doing a fantastic work, keep on that!

Sam

1 Like

Can you send me the project in question? here, or privately to mh@remobjects.com is fine.

:smile: I have send you email. as i can’t attach file here.

1 Like