Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

XCode starter
Started by horacebury Sep 25 2018 05:21 AM

12 replies to this topic

Best Answer agramonte , 25 September 2018 - 02:06 PM

What I have made so far:

 

Part 1 : In this video, we start to set up the project. We are making a Tapjoy plugin to track installs.

Part 2 : In the second part we modify the file names, bring in an external framework and add an additional method.

Part 3: In the third part, we make changes to pass in the 2 parameters we need, we plug in those parameters into the function and we make sure it builds.

Part 4: This video we go through the first two tasks before we can test our plugin.

Part 5: The last two steps to get ready for testing. In the next video will test on a device.

Part 6: Fixed mistakes done in previous videos, showed how to update the plugin and ran the plugin on an iPhone.

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

horacebury

[GLOBAL: userInfoPane.html]
horacebury
  • Corona Geek

  • 2,984 posts
  • Corona SDK

Looking to start building plugins. Being kneecapped by the horrors of Xcode. Does anyone have a tutor or other resources for getting started. Yes, I’ve googled!

[TOPIC: post.html]
#2

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Contributor

  • 811 posts
  • Corona SDK

Let me warm up my crappy voice and I'll quickly record a youtube video on how I do it during my lunch hour. stay tuned....


  • horacebury likes this

[TOPIC: post.html]
#3

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Contributor

  • 811 posts
  • Corona SDK

  Best Answer

What I have made so far:

 

Part 1 : In this video, we start to set up the project. We are making a Tapjoy plugin to track installs.

Part 2 : In the second part we modify the file names, bring in an external framework and add an additional method.

Part 3: In the third part, we make changes to pass in the 2 parameters we need, we plug in those parameters into the function and we make sure it builds.

Part 4: This video we go through the first two tasks before we can test our plugin.

Part 5: The last two steps to get ready for testing. In the next video will test on a device.

Part 6: Fixed mistakes done in previous videos, showed how to update the plugin and ran the plugin on an iPhone.


Edited by agramonte, 26 September 2018 - 10:17 AM.

  • horacebury likes this

[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,714 posts
  • Corona Staff

This tutorial will create a basic "flashlight" plugin. It's done with a couple of versions back of Xcode, but I doubt much has changed that much. At least the code side should still be valid.

 

http://docs.coronalabs.com/tutorial/native/iosIntro/index.html

 

Rob


  • horacebury likes this

[TOPIC: post.html]
#5

horacebury

[GLOBAL: userInfoPane.html]
horacebury
  • Corona Geek

  • 2,984 posts
  • Corona SDK

Thank you guys! Going to dig into this ASAP! Can’t believe the effort :)

[TOPIC: post.html]
#6

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,714 posts
  • Corona Staff

It seems like a lot of work when you start, but once you get the framework in place and understand the C-Lua bridge code and any native specific features you may initially struggle with it will get easier and more comfortable.

 

For instance, I really struggle with "delegates" and "where did that native Objective C API call come from?" "Where are all the options?" What do I have to write?  Corona's Lua based APIs really makes it easy on developers as it hides all of the native ugliness.

 

Rob



[TOPIC: post.html]
#7

horacebury

[GLOBAL: userInfoPane.html]
horacebury
  • Corona Geek

  • 2,984 posts
  • Corona SDK

I really love Corona for it's ease of use, the graphics system is so capable and the physics engine is so manipulable. But now there are plugins and somewhere inspired by Scott H's work, I want to expand the offerings.

 

My big problem is XCode and the fact that every time over the past years that I've tried to get going with it, I've failed utterly. It is so completely alien to what I know that I find any tutorial is quite simply not a "from scratch" experience - they all require assumptions which are extremely difficult (impossible?) to avoid making differently when you have years of experience in another system.

 

Simply trying to get XCode playgrounds to show me something when the default template code should run out of the box was confusing - until I realised that it's not going to actually show a window; Everything it renders is right there in the code window (at least, that's how it appears to me.)

 

I still haven't had time to go through your videos, but I will ASAP! Thank you again!



[TOPIC: post.html]
#8

horacebury

[GLOBAL: userInfoPane.html]
horacebury
  • Corona Geek

  • 2,984 posts
  • Corona SDK

Hey @agramonte, a little off topic, but what tool did you use to record your video and what's the little icon in your top bar which looks like a speedometer?

 

Back on topic... I notice that you're working with .mm and .h files, so that code is Obj-C; Is Swift supported for plugin development?



[TOPIC: post.html]
#9

horacebury

[GLOBAL: userInfoPane.html]
horacebury
  • Corona Geek

  • 2,984 posts
  • Corona SDK

Anyone interested in writing plugins for Corona should watch this series by Adrian Gomez:

 

https://www.youtube.com/playlist?list=PLzlEhF55FpRIXXk0rDpKU9Yn1pNYF8D-W


  • agramonte likes this

[TOPIC: post.html]
#10

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Contributor

  • 811 posts
  • Corona SDK

1. The speedometer is a the BassJump II utility. It is a subwoofer for your Macbook. More gimmicky than useful. Mine is in a box somewhere in a closet. It is only $34.00 now. Much cheaper than when I first got it. 

2. I use just QuickTime to both edit and record. My machine can't handle anything else.

3. I do not believe Swift is supported. I have not seen any documentation or examples in Swift, but the limitation I don't believe is Corona. It might be LUA bindings. If you look at other Lua game engines processes to create native plugins those are very similar to Corona. Rob would probably know more.

 

I found this two year old quote from Rob (it might need a little updated), but I think everything he said still holds true:

 

 

So here's the deal.

 

1. You cannot make plugins in Swift. Plugins use static .a libraries. Swift cannot produce these. Swift can create frameworks, but that's not something we can use in Corona SDK. It will probably be a big engineering effort to get there.

 

2. There is no good Swift-Lua interface. Lua was built for C++. In Xcode, you can mix Objective-C and C++ (and C for completeness) in the same files. This makes Lua->C++ easy and you can make Objective-C calls as needed.

 

3. What you can do is have a Swift class and have a C++ wrapper. In other words lets say you have a Lua call:

 

library.show()

 

That would call a C++ function called show(). It would then take parameters you passed from Lua and turned into Objective-C data types like NSDictionary, NSString, etc. and it would call your Swift classe's show() method.

 

We are going to produce a sample project that makes this all possible, but it needs to go through a code review before we can upload it to our Github repo.  So we might have something soon if we don't find further issues.

 

The project is setup to basically make a non-plugin plugin if that make sense. Its called Plugin in the code and gives you plugin like access (i.e. local library = require( "plugin.library" ) in your Lua code), it's just not a distributed standalone plugin.

 

Rob

 

Edited by agramonte, 27 September 2018 - 12:03 PM.

  • horacebury likes this

[TOPIC: post.html]
#11

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,714 posts
  • Corona Staff

Swift should be supported. Initially, we did not because Swift could only create frameworks and not ".a" library files. But we started supporting frameworks some time back. Back when I messed with it last time, there were some extra things needed to set up a Swift to C bridge. But that was like in Swift 1 and 2 days. We are now up to Swift 4 I think and I don't know if that's still required or not. I can ask an engineer to chime in more on this.

 

I do know that we had Swift working for CoronaCards for certain. You might want to grab some of those projects from our GitHub account and poke around in them. The Swift-C bridging isn't really anything Corona specific.

 

Rob



[TOPIC: post.html]
#12

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 543 posts
  • Corona Staff

Hey!

 

Corona does support Swift at this point, as well as dynamic libraries (packaged in frameworks), which can contain Swift. However, Lua Bindings is a problem. It can be easily bypassed by using Swift-Objective C bridging. This allows to write parts of code with Swift, but still all interface has to be written with ObjectiveC (or C) because of lua_ calls. This probably can be helped with usage of some wrapper, but I didn't look into it.

 

If you have some codebase written in Swift, I can probably provide with example of plugin which uses swift, so you can make a plugin out of it.


  • ojnab and agramonte like this

[TOPIC: post.html]
#13

horacebury

[GLOBAL: userInfoPane.html]
horacebury
  • Corona Geek

  • 2,984 posts
  • Corona SDK

Thanks guys - I have no code in Swift or Obj-C at the moment. Just starting out with all this. I have an idea for a plugin, but it's a long way to go with a lot of learning ahead, yet...




[topic_controls]
[/topic_controls]