Is it possible to create a playground in Xcode and run that playground on an iPad using the built in sensors and showing the view (timeline) on the right side of the screen? Is the possibility of selecting the platform iOS when you create a playground just for testing iOS code?
So I've been doing a bit of research to answer this question and I cannot definitively say for certain each part of it.
What I can answer is the possibility of running Playgrounds that were created in Xcode on iPad and the answer is yes. I outline below what I tried but there may be solutions out there I'm missing so please feel free to contribute.
To begin with, I have Xcode 8.2.1 installed on my MacBook Air which enables me to create new Playgrounds projects. Additionally, I have an iPad Air with the Swift Playgrounds app installed on it. I believe Swift Playgrounds requires at least iOS 10 to run.
I did some research and found the main page for Apple Swift Playgrounds. At the bottom is text that reads:
Take things to Xcode. Then take them further. Because you’re working
with real code, you can import and export directly between Swift
Playgrounds and Xcode. So you can try out your ideas with the tool
pros use to develop iOS and Mac apps.
I wanted to experiment and figure out how to "import and export directly between Swift Playgrounds and Xcode."
First, I created a new simple "Hello World" Playground in Xcode called Test.playground. You can imagine it would look like the following:
import UIKit
print("Hello World")
Second, I used AirDrop to transfer the Test.playground from my MacBook Air to my iPad Air. My iPad gave me the option to save it to iCloud Drive so I did. This is a feature that needs to be enabled in Settings.
Third, I launched the Swift Playgrounds app on my iPad Air. The + sign at the top left allows you to "Create Playground" or access iCloud Drive (or Dropbox, etc) to import a Playground. I selected iCloud Drive since that is where I AirDropped my Test.playground from my MacBook Air. iCloud Drive will have a folder that stores all the Playgrounds for the app called, "Playgrounds." Tapping inside that folder I could see my Test.playground which I selected.
Once you select your Playground, it should open up. I was able to press "Run My Code" and see "Hello World" printed out.
And that's about as far as I got in figuring out how to import/export Playgrounds between Xcode and Swift Playgrounds (on iPad). I have to experiment more to determine the full scope of functionality/similarities/differences between the two platforms (running Playgrounds in Xcode and Playgrounds in the Swift Playgrounds app on iPad).
I hope this helps a little.
Related
On all apps that I can find that use Cardboard in iOS 14 (iPhone), the VR view is insanely bugged. The camera swings wildly all over the place.
Here is a video example: https://www.reddit.com/r/youtube/comments/i1nbs0/ios_14_vr_error/
The official Google Cardboard app-store application is broken as soon as you start it. It is also broken on the app I develop for which uses GVR and Unity.
Weirdly, it will temporarily function as expected if you restart your iPhone. The time it takes to break is seemingly random - sometimes it will be broken right away, and sometimes it will work for hours before breaking.
We have tested this on two iPhone 8+, and an iPhone 11.
Things I have tried:
Updating to beta iOS14.2 does not fix the issue.
Rebuilding in Xcode 12.2 Beta does not fix the issue
No errors or warning appear in my local build for our GVR project.
Turns out GVR is now obsolete for IOS14 (unless someone makes a fix for it.. doubt it). Have to upgrade to Cardboard SDK.
https://github.com/googlevr/cardboard/issues/118
I've answered this question on the Official Goggle Cardboard repository, but here's a quick recap for who got here first:
This is a iOS 14 incompatibility with the (now obsolete) Google Cardboard Plugin for Unity. I don't know for sure if there's a workaround to continue using this plugin, but I've tested the new plugin on both iPhone XR and SE and it works exactly as expected.
I've even loaded my app and the test app side by side, having the first one with a completely bugged view as described on the post and the test app, with the new plugin, working normally.
Finally, in order to continue using Cardboard VR with Unity on iOS 14, you should:
Upgrade to Unity 2019.3.15f1 or later
Integrate the new Google Cardboard XR Plugin
The new Cardboard XR plugin fixes this iOS 14 issue however, it was still somewhat buggy for me. My solution to this was to update my app with the Mobfish Google Cardboard package. I highly recommend it. It works with Metal/OpenGLES2/OpenGLES3 and default renderer/URP/HDRP. It also works with unity 2018 and up so no XR subsystem is needed. I published an update to my app using this plugin and it fixed the issue that arose from iOS 14.
Alright so look. I'm using an I7 updated to the most recent version of IOS14 AND Unity 2020.1.9f and xcode12, I've integrated the project EXACTLY how the https://github.com/googlevr/cardboard-xr-plugin shows it to be more specific here's the actual step by step page I followed and the ONLY way it has worked for me so far(does work outside of the test scene too just reverse engineer what's in the test scene or create a prefab of the player and drag and drop into your original scene then delete the old sample scene out of your build scenes)https://developers.google.com/cardboard/develop/unity/quickstart
obviously make sure you follow the steps for your phone, but make sure you follow every step exactly how it's done.
I WOULD NOT RECOMMEND DOWNGRADING PAST 2019.4.11f
Anything past 2019.4.11f has a bunch of depreciated scripts that will either cause issues in build or in xcode, also the new unity is set up to allow people to easily ask for permissions now needed with iOS' new privacy policy and security. For example if you build a successful VR project in an older version of Unity you MAY be giving up other cool features like voice command and etc...
FYI:
I was able to make it work without the need of compiling anything.
(I use a DESTEK V5 headset with an iPhone 11 running iOS 14.5 beta)
How I solved it:
I just updated to 14.5 beta, but also
I installed "Player360" from Mobfish.
After a restart, it works perfectly.
VR cardboard view 1
VR cardboard view 2
Please the experts explain what might be the trick happening here:
I don't know if it was the update to 14.5 beta and/or installing the app from Mobfish. (I thought if I installed an app with the Unity plugin update for iOS 14.X embedded, I might be forcing iOS to use the Unity VR version what was on its RAM).
CAVEATS: the issue comes back under the following conditions:
After switching from one VR app to another
After using the VR app for a long period (I use Holofit for indoor rowing)
Solution: Restart iOS
UPDATED
I wanna make AR app for WWDC Scholarship 2020. And the problem that I dont have IPad to test works AR or not in playground. How I can test my playground project on my mac?
Xcode Simulator still doesn't support AR apps (nor Xcode Playground). The only way you can run or test your AR app is to compile it for iOS/iPadOS device. Also you can use Swift Playgrounds for iPad.
Universal link working on simulator only every time when tap on it it will open application.
If i am directly run on device then it's not working it will just open safari not application. Same problem with .iPA file and TestFlight.
NOTES:
1. I am try to run on iOS 11.0 (iPhone 6s).
2. I have set and tried with debug and release both configurations.
can You put a sample piece of code? I will be happy to test on my devices MAD give some clues.
I found a lot of sample code in stack overflow about it.
I've recently started working on an existing objc project and wanted to check the memory graph debugging tool. As I started a debugger with the app I realised it doesn't show in the debugging tools.
I tried it with another project (created a new swift project) and the icon suddenly did show again. But only for this project.
So my question now is if there're any settings in a particular project that can prevent the memory graph debugging tool from showing?
Any hints are appreciated.
I tried a lot of different simulators (iOS 9/10/11). I event tried rebooting my macbook because I read somewhere this could help ;-)
I'm using an objc only project with Xcode 9.1 or Xcode 9.2 beta 2.
This is my diagnostics selection in the scheme if that's related:
Step 1: shut down and restart your iPhone.
Step 2: quit and reopen Xcode.
This should make the button reappear.
For some reason, the button is not there when I test on the device, but it's there when I test on the simulator.
Hi I was having the same issue. It's actually hidden here:
It appears that the memory debugger will only work for newer devices. It definitely does appear on the iPhone 8 running iOS 11. On some of my older devices it does not appear. I'm not sure at this time what the cutoff is.
I recently tried opening/editing a .playgroundbook project in Xcode Version 8.3.2 (8E2002), and was somewhat surprised that it didn't open as a "liveView Playground" (I realize it's mostly a package of .swift files with manifests).
Maybe I'm totally missing the point here, or was the format never intended to be used this way?
Swift 5, Xcode 11, Catalina
Swift Playgrounds can now run on either iPad or macOS (10.15.3 or newer).
Related: Swift Playgrounds Release Notes
Caveat: However, the most-recently available "Swift Playgrounds Author Template for Xcode 11.1 (for Swift Playground 3.3)" does not build "as-is" with the current Xcode 11.4.1 release.
Xcode 8
Creating and Running a Playground Book indicates that…
You use both a Mac running Xcode and an iPad to create a playground book.
The only recommended (supported?) workflow for a *.playgroundbook appears to be "edit in Xcode, run on iPad" with Starter.playgroundbook provided as a starting point.
The suggested workflow is:
Make targeted changes to the book’s content and structure in Xcode
Transfer the updated book into Swift Playgrounds using iCloud or AirDrop
Open the updated book and test the changes
Note any additional changes that are needed, and return to step 1
Note that an iPad Playgrounds + ➜ New Playground ➜ Blank creates a non-book *.playground that can be run both on iPad and in Xcode.
Pages can be added although *.playground is not a *.playgroundbook.
Note: iPad currently uses a newer version of contents.xcplayground than Xcode 9, so CREATE a blank *.playground and ADD new *.playground pages on the iPad to be seen in both iPad or Xcode.
contents.xcplayground
<playground version='6.0' target-platform='ios'>
<pages>
<page name='Page One'/>
<page name='Page Two'/>
</pages>
</playground>
Apple recently (WWDC '18) releases a new template that allows you to create, debug, and produce a PlaygroundBook right on your Mac.
You can use Playgrounds Author Template:
The Swift Playgrounds Author Template is a starter Xcode project that will help you create, debug, and produce a Playground book. Using the template you can step through the code for your live view as if it were an app so that you can identify bugs more easily and develop an efficient workflow for developing your Playground books.
I write about this more in details in this answer