Open Schlumpfpapa opened 6 years ago
Hi @Schlumpfpapa 👋
I agree, that would be amazing! I don't know if it's yet possible to import 3rd party frameworks in Swift Playgrounds for iPad though. I don't have an iPad myself at the moment, so I'm not able to try this out or work on this. But if anyone wants to check it out, and if we need to make any changes in the framework itself to make it happen, I'm all for it 👍
Hi again,
Using a precompiled framework in an iPad Playground is not (yet?) possible as far as I know. What is possible though, is putting a buch of source files into the „sources“ directory of a Playground. These files are getting precompiled and you can use them from the main playground file like any other code which is included there. This can be tested with xCode Playgrounds on a Mac too. Unfortunately I was not able to get it running by simple adding the three folders („API“, „Internal“ and „UIKIt“) into the „sources“ directory, but I might have done something wrong.
OK, actually it already does work. All you have to do is put all the files from „API“, „Internal“ and „UIKIt“ into the „sources“ folder except the files with names ending in -macOS.
Perhaps it would be a good idea to move those files in the project to a different location to simplify the process for iPad users.
You also have to put the resources folder from the Tutorial Playground into the iOS Playground.
The first few lines from the tutorial running on an iPad:
That is AWESOME 🚀 My desire to buy an iPad just got multiplied by 1000 😅
OK to close this now then?
Sure. Perhaps it would be a good idea to write some hints into the docs though and to move the offending files elsewhere perhaps, like said above.
Unfortunately I have not much practise in collaborating to a git project, otherwise I could make a pull request myself and correct the error in the tutorial code (missing import PlaygroundSupport).
That's a great idea - I'll take care of it 👍 Actually the playground that the tutorial comes with already includes the PlaygroundSupport import 🙂
Thanks a lot for bringing this up and for helping me figure out how to use Imagine Engine in Swift Playgrounds on iPad - this is really exciting 🎉
I now was able to get the whole Tutorial Playground running on an iPad. Except for one „small“ detail: Tapping the asteroids does not trigger clicked events.
Hmmm interesting. Do UIGestureRecognizer
s normally work in a playground's live view on iPad (because that's how the click handling is implemented)?
I have written an iPad Playground using SpriteKit. At least SKView.touchesBegan and SKView.touchesEnd work as expected.
Since I don't have access to an iPad I'm afraid I can't be of much help debugging this 😢
@JohnSundell This is very interesting and I do have an iPad :)
What if we had a script that generates a pre-configured playground for the developer? 🤔
Would be great if ImagineEngine could be used in iPad Playgrounds.
As a first step I tried to put the folders „API“, „Internal“ and „UIKIt“ in xCode into an iOS Playground's „Sources“ Folder. Unfortunately xCode is stuck on „Compiling ImageEngineTest“ for over an hour now.
Can this be achieved somehow? Having ImagineEngine on iOS Playgrounds App would be huge!
Thanks and keep up the good work!