230 likes | 342 Views
Java on ios ? yes you can !. Niklas Therning / @ ntherning Henric Müller / @ henricmuller Trillian Mobile AB r obovm.com. The RoboVM Project. Goal: Java on iOS and other JVM languages: Scala , Groovy , Clojure, … Open -source since Jan 2013 github.com/robovm
E N D
Java on ios?yesyoucan! Niklas Therning / @ntherning Henric Müller / @henricmuller Trillian Mobile AB robovm.com
The RoboVM Project • Goal: Java on iOS • andother JVM languages: Scala,Groovy,Clojure, … • Open-sourcesinceJan 2013 • github.com/robovm • License allows closed source apps • www.robovm.com / @robovm
RoboVM Features • Java bytecodetomachinecode • AheadOfTime, no interpreter, no JIT • Fastapps • Runtimeclassesbased on Android • java.*, javax.*, etcincl. I/O, reflection • Supports 3rd party JAR files • Supports standard JNI(static)
RoboVM Features • Bindings for nativeiOS APIs • Full access to hardware, services, UI, etc
RoboVM Features • Integrateswithpopular Java tools • sbt • Leiningen
RoboVM is … … not an AndroidtoiOSappconverter … not a Java toObj-C source translator … not only for games* * (Though it worksgreat for games too!)
Current Status • 100+ apps in App Store • Thousandsofusers • 1.0 scheduled for late 2014
1.0 Alpha 2 just released! λ Introduces lambdas and default methods
Showcase: ContractRPunch clock for contractors
Cross-platformappdevelopment Option #1 – Native UI
Cross-platformappdevelopmentOption #1 – Native UI • Pros • UserExperience • Performance • Cons • Less codereuse • Learning curve – API/tooldifferences
Cross-platformappdevelopmentOption #1 – Native UI Usepatternstomaximizecodereuse MVC MVVM Controller Controller Viewmodel Viewmodel View View Model Model View View Model Model
3 separatemodules Core (model) Android iOS
Common modelcode: publicclassClientModel{ publicClientcreate() { … } publicintcount() { … } publicClient get(intindex) { … } …
UITableViewCellgetRowCell(UITableViewtableView, NSIndexPathindexPath) { UITableViewCellcell = tableView.dequeueReusableCell("cell"); if(cell == null) { cell= newUITableViewCell(UITableViewCellStyle.Value1, "cell"); cell.setAccessoryType(UITableViewCellAccessoryType.DisclosureIndicator); } Clientclient = clientModel.get((int) indexPath.getRow()); cell.getTextLabel().setText(client.getName()); returncell; } iOSspecific UI code:
publicViewgetView(int position, ViewconvertView, ViewGroupparent) { Viewview= convertView; if (convertView== null) { view= inflater.inflate(android.R.layout.simple_list_item_1, parent, false); } Clientclient = clientModel.get(position); TextViewtext= (TextView) view.findViewById(android.R.id.text1); text.setText(client.getName()); returnview; } Androidspecific UI code:
Cross-platformappdevelopment Option #2 – Cross Platform UI JavaFX from the OpenJFXproject
Cross-platformappdevelopmentOption #2 – Cross Platform UI • Pros • Close to 100% codereuse • Cons • UserExperience • Performance
Cross-platformappdevelopmentOption #2 – Cross Platform UI DEMO #2
ContractR and othersamplescan be found at github.com/robovm/robovm-samples
Commercial Licenses • Launch late 2014 • Standard Java debugger support • Support options Open source version still letsyoudevelopamazingapps for freewithout limitations!
? Check outwww.robovm.com and follow @robovm