Re: [swift-users] Build Android GUI apps with Swift 3.0 via a framework/library

2016-10-18 Thread Tony Constantinides via swift-users
So according to the Swift Community I should adapt Kotlin and not Swift as
my choice for the programming language for a  cross-platform GUI framework?
Is that really going to be easier than building a GUI framework for Android
as listed on this page?
https://github.com/apple/swift/blob/master/docs/Android.md

The main technical issues I can think of when building Android Java API
Access is the following:
a) You can only call static Java methods from the NDK Main Thread in Android
b) If I go the Android NDK(C/C++) approach, it provides access to the C++
API of Android but not the Java API of Android. It bootstraps differently
in that you have access to a NativeActivity class but a lot of Java Android
is deriving from an Activity and adding your overrides. I wonder if that
possible doing that with JNI
c) You would not have access to the XML way of declaring an Android GUI but
will have to do everything in code (I have experience in this in Android).
This is not a problem just extra work
d) Since the Java API of Android bootstraps differently you would need to
add libraries to your module maps in Swift so you can bootstrap the Java VM
literally in Android so you have access to the Java Environment via Java
Native Interface.

Anyone else think of how to call Java API from Swift? I was thinking  a
bootstrap Java Android skeleton app, which receives an API via a 64 bit
encoded number. The number is converted into a string and passed into a
switch statement where the correct API call is made.
Any fresh ideas?
Sincerely yours,
Tony Constantinides







On Mon, Oct 17, 2016 at 9:34 AM, Jens Alfke  wrote:

>
> On Oct 16, 2016, at 1:35 PM, Tony Constantinides via swift-users <
> swift-users@swift.org> wrote:
>
> Kotlin does not run on iOS without some custom VM (Robot VM) which would
> kill performance.
>
>
> If you mean RoboVM, it claims to use ahead-of-time compilation of Java to
> native code, so there shouldn’t be much of a performance penalty.
> (Definitely a *size* penalty, though!) However, RoboVM appears to have
> been discontinued.
>
> —Jens
>
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


[swift-users] Syntax highlighting for all core libs projects in Xcode8?

2016-10-18 Thread Karl Peng via swift-users
Hi,
Seems all core libs projects syntax highlighting is broken in Xcode8. 
Anyone has a solution for this?
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] comparison Non-Optional and Optional without unwrap

2016-10-18 Thread Rien via swift-users
Because the comparison function “==“ has the signature: 

func ==(lhs: T?, rhs: T?) -> Bool

An optional parameter accepts non-optionals. In a sense non-optionals are 
“promoted” to optionals when used for an optional parameter.

Rien.

> On 18 Oct 2016, at 10:58, Седых Александр via swift-users 
>  wrote:
> 
> This code work: 
> 
> let one: Int? = 5
> let two = 5
> let result = one == two
>  
> print(result)
> 
> //print true
> 
> Why we can access to Optional value without unwrap within comparison 
> operations?
> 
> -- 
> Седых Александр
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] comparison Non-Optional and Optional without unwrap

2016-10-18 Thread Alex Blewitt via swift-users

> On 18 Oct 2016, at 09:58, Седых Александр via swift-users 
>  wrote:
> 
> This code work: 
> 
> let one: Int? = 5
> let two = 5
> let result = one == two
>  
> print(result)
> 
> //print true
> 
> Why we can access to Optional value without unwrap within comparison 
> operations?

The 'one' value isn't being unwrapped; the 'two' value is being wrapped in an 
optional, and then compared. In effect, it's doing:

let result = one == Optional(two)

This allows you to pass in non-optional values to functions that take optional 
arguments, e.g.

func printme(_ i:Int?) { print("\(i)") }

printme(one)
printme(two)

Alex___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


[swift-users] comparison Non-Optional and Optional without unwrap

2016-10-18 Thread Седых Александр via swift-users
This code work: 

let one:  Int ? =  5
let two =  5
let result =  one ==  two
 
print ( result )

//print true
Why we can access to Optional value without unwrap within comparison operations?

-- 
Седых Александр___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users