With Swift open sourced, what would it take to have it running on the JVM? [closed] - swift

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I program in Objective-C and Swift primarily and understood Apple's announcing Open Source Swift by end of year as a move to make it available for backend programming as well. To quote Craig Federighi (SVP Engineering) in the keynote “We think Swift is the language we'll be doing application and systems programming”. The mention to systems programming and the mention that there will be libraries for Linux seems a clear indication on the path to using as a backend development language as well.
So my question relates to two possible paths that could take. On the one hand, Swift's page says that “Using the incredibly high-performance LLVM compiler, Swift code is transformed into optimized native code that gets the most out of modern hardware.” This would mean that it would have to be compiled for each target hardware I assume. Is this assumption correct?
On the other hand, if Swift was compiled to the JVM I assume it would make Swift's adoption much wider and faster because it could take advantage of the JVM's hardware independence.
I guess the point of my question is: are these two assumptions above correct? Would it even be possible to compile Swift to the JVM? If so, what advantages and disadvantages would it have over native code to each target hardware.
I am curious to understand if this is on the ballpark on how to think about this development for Swift.

LLVM IR can be used as a platform-agnostic binary distribution method. Google does exactly this with PNaCl. http://www.chromium.org/nativeclient/pnacl/introduction-to-portable-native-client
I don't know if JVM provides advantages over LLVM IR but it's not the same as locking into one exact binary format.

Related

What are the pros and cons of using Swift for a Mac app? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm starting development of a new app, with no existing codebase to reuse. I'm very comfortable with Objective-C, but wanted to build the app in Swift, given that that's the future. But before that, I have a few questions:
Does the Mac App Store accept apps written in Swift?
Swift 3 isn't binary-compatible, so does that mean that the next version of macOS might break my app? Might I end up with a situation where I'll have to maintain two binaries for different versions of macOS?
Are all the Xcode debugging tools available for Objective-C also available for Swift?
Are there any other factors that relevant to this decision?
I don't see any restriction regarding Swift apps. They are accepted in the Mac App Store and whatever version of Swift you use, they'll be compatible with recent and future macOS versions. And the debugging tools work for Swift as well.
Having said that, there are advantages and disadvantages:
Advantages:
Modern language, superior to Objective-C
Full commitment by Apple
Can easily be mixed with Objective-C (e.g. with 3rd party libraries)
Disadvantages:
Bigger app as all apps need to be bundled with Swift Runtime libraries.
It's not possible yet to create binary libraries in Swift. They have to be distributed in source code.
Refactoring in XCode only works for Objective-C.
The language is still evolving. Even though XCode helps to upgrade if the language changes, there's still manual work and retesting involved.

why class prefixes are still followed in apple's latest frameworks [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Coming from high-level languages like Visual C, C#, Java, ActionScript where packages are a common and basic thing since their inception, and there were many scalability issues around name collisions and I always thought objective-c as the language not up to date.
Now since we have namespacing available and is implicit across modules, why classes are still prefixed, for instance I was going through this WWDC 16 video Enhancing VoIP Apps with CallKit, and classes are still prefixed with CX, this should be the thing of the past now.
Swift 3.0 does emphasize removing repeated elements, they revised and shortened many function names, is there a way to get rid of this NS prefix or are they going to do something about it or still going to prefix their class libraries just like they did with CallKit. It's still a repetition.
Now since we have namespacing available and is implicit across modules, why classes are still prefixed
Because the APIs are written in, and must remain usable by, Objective-C, which has no namespacing.
The NS is now (Swift 3) gone from the Foundation classes, which is certainly something. This is accomplished by putting an "overlay" in front of the Foundation API. In the future, this could be done with other frameworks. (Questions about the future, however, are inappropriate for Stack Overflow, and you are as capable of reading the swift-evolution site as everyone else is.)

UPnP for iPhone [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
What free upnp library would you recommend for iPhone development? It has to support control point features and allow to serve files off from iPhone.
There is an open source project on Sourcefourge that will do this called CyberLink for C
It is written in C which integrates with Objective-C easily, but they provide Objective-C wrappers also. With it you can create UPnP applications easily with Objective-C on Mac OS X.
This is not to be confused with the Cyberlink DVD player software. They are two completely different things.
Consider this one: http://code.google.com/p/upnpx/
There is also MiniUPNP, http://miniupnp.free.fr/ which is open source. It is in C and written for POSIX, no idea if that works on the iphone.
This is another vote against CyberLink. Lots of bugs, basic functionality is missing, and way too slow on mobile devices (I think the main performance problem is that it is designed around DOM based XML parsing rather than SAX based).
I have heard a lot of people mention using the Platinum UPnP library, but so far I haven't found any Obj-C wrappers for it. I may just bite the bullet and do that soon.
Does anyone else know of a Platinum Objective-C wrapper?
I'm currently playing with the CyberLink, and it's loaded with bugs :(
I think that the Portable UPnP should be better, as it's actively maintained (although the last release was several years ago, the subversion repository is constantly updated).
As you asked this question almost year ago, I wonder how things turned out.
You can use ohNet. It contains both control point and device stacks, is available under a BSD license and has C++ and C APIs which are usable on iPhone.
(Disclaimer: I have contributed to this project)

How to write a WOL app for iPhone? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Wake on LAN so cool, just want to write a iPhone app to WOL my PC, but have no idea to code, any one can point me the way?
If you've no experience of programming, then this is a very large first step. (More of a sheer vertical incline really.)
As such, you might want to take a step back and have a look a some basic (or indeed BASIC) programming tutorials. (Google is your friend.)
Alternatively, Apple has good online documentation regarding Objective C and the Cocoa (the language and framework that iPhone applications are written in.) A good place to start for this would be Apple's Introduction to The Objective-C Programming Language.
Basically you need to send a magic packed as described here, to do that you'll need basic programming knowledge and some knowledge on socket programming, here is a good book on the subject. There are numerous examples of that.
But in the end perhaps I could persuade you to purchase one of several iPhone applications that do exactly that, or grab the free one?
You'll need an understanding of bsd sockets as well as the user interface kit framework to put the necessary controls on the screen.
Or of course download an existing free app like this one which does it already, automatically detects your mac address, and also tells you whether your machines are on or off:
http://itunes.apple.com/us/app/wake/id396566137?mt=8
All the best for your projects.

How to start programming for the iPhone? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I come from a .Net C# background, what's the best way to learn how to program native applications for the iPhone?
Have a look at the Stanford course on iPhone development. It will really get you started.
Everyone has posted nice resources, but even if you already know the language you have to use, I just wanted to state it so that other people who probably don't know it, can see.
The language used for developing Apple sanctioned, native applications is Objective-C. Of course, you can mix in C and C++, but the SDK itself is in Objective-C, so you might want to learn that. It looks a bit scary at first to most people, usually those coming from higher level languages such as C#. The brackets and supposed 'verboseness' turns some people off. After a while though, it grows on you and you'll notice it's a very readable and self-documenting language.
I personally used the book titled Learning Objective-C which was perfect for me as someone who is already familiar with programming languages, preferably C-style languages, and wanted to learn about the main differences in that language. The other, longer and I imagine better reference of a book is the popular Programming in Objective-C 2.0. This book is longer and starts off assuming the reader has 0 programming experience, going over control structures, Object Oriented Programming basics, etc. I believe both books have cheaper and searchable PDF versions.
Have fun and I hope all goes well for you in this venture.
In case you didn't know it: You can also use C# to program on the iPhone through MonoTouch. And in fact MonoTouch does also compile down to native ;)
I found the Beginning iPhone 3 Development book to be a very good way to get started.