How do you implement SpriteKit within a WatchKit extension app? - ios

I am trying to extend a SpriteKit-based iPhone app to the Apple Watch, however given that Watch extensions do not use UIKit and UIViews (instead using WKInterfaceObject and its subclasses), I am not sure how I can setup my SKView and SKScene within the Watch extension.

This is old, but just wanted to mention that in watchOS 3 you can use SpriteKit and SceneKit.

You can't use SpriteKit in a WatchApp. You can ONLY use the UI elements provided for a Watch App. You can't create custom UI elements. The closest you can get is to create custom images in your watch extension running on the iPhone and set those in your Watch UI. See Watchkit animation implementations: clock face, animated charts, circular progress bar for more info.

Related

How to build a PagerView in WatchOS

How can I build or get (library) a PagerView in WatchOS. I can't find a way to do it without SwiftUI. I have a library for UIKit (https://github.com/WenchaoD/FSPagerView) but i cant use it for watchOS
Use SpriteKit for custom ui on watchOS
If you can't use SwiftUI, WatchOS only has SpriteKit and SceneKit.
Your app isn't a game, but there's no difference to the computer, only to the user. A game is just a fun app.
You need to have a WKInterfaceController that hosts a WKInterfaceSKScene view and the WKInterfaceSKScene presents an SKScene
For a pager type view of images that you can swipe between, then you might have a scene with some SKSpriteNodes, for example 3, with one on screen, one to the left, one to the right, and move them around and change their images as user drags about. Or whatever you want, maybe a SKTileMapNode or so.
For dragging, maybe a WKPanGestureRecognizer on the WKInterfaceController - you need to ensure you're not in a paged based interface, only fullscreen or navigation based would work for that. You also want to allow the crown to be used, so implement WKCrownDelegate

How to launch multiple instances of a scene on iPhone with iOS 13?

The apple developer docs mentions that multiple instances of a scene are available on iOS 13 (ie both iPhone and iPad)
From their developer docs:
In iOS 13 and later, the user can create and manage multiple instances of your app's user interface simultaneously, and switch between them using the app switcher. On iPad, the user can also display multiple instances of your app side by side. Each instance of your UI displays different content, or displays the same content in a different way. For example, the user can display one instance of the Calendar app showing a specific day, and another showing an entire month.
I have tried it on iPadOS and I am able to create multiple scene instances using the gesture and UI actions mentioned in their WWDC videos but I have not found any reference around how to achieve that on iPhone, it would be really helpful to know how to achieve this or whether it is possible or not.
The documentation you quote is misleading due to the use of the term "iOS".
The ability to create multiple scenes for an app in iOS 13 is actually limited to iPads and iPadOS. You can't create more than the one app scene on an iPhone in iOS.
Use UIApplication.sharedApplication.supportsMultipleScenes (Objective-C) / UIApplication.shared.supportsMultipleScenes (Swift) to check if the current device supports multiple scenes. You will find that this return NO/false on iPhones and YES/true on iPads.
That check is useful to enable/disable the ability to use drag and drop that creates an NSUserActivity or UI components that lead to uses of UIApplication requestSceneSessionActivation.

Passing Data From native iOS app to Unity App

I have iOS app now i want to add some animation in my app so i think to create Unity app for that animation. So now i want open unity app from my iOS app with button click action are you getting ?
Now animation is generate the dynamic number ball so for that i have to pass the parameter(Number of total ball, Number of ball to ball generate, Ball colour code) to unity app from iOS app.
So is there any possible way to pass the data from iOS app to Unity. I i'm thinking to use URL Scheme Or any other method available?
I am assuming you want to communicate between two apps. For that there are several ways.
To open other app within an app, please check this answer here.
Solution 1:
Don't use two apps to do single animation. Thats not good practice and not feasible. Do animation inside your iOS app and I believe iOS is powerful enough to handle your animation. Apple has already suite of game technologies to support gaming development in iOS natively. You can check this link here.
Solution 3:
If you can build app in unity, build whole app in unity.
Solution 2:
The first part of your question is very confusing though. You want to show animation in your iOS app but want to create animation in unity app? That is not going to work. Because when you open unity app, the current app will be suspended as default and you will only see unity app at that time.
As per your 2nd part of the question you want pass some arguments from iOS for animation to play in unity app. To do that you have to save data locally (in some kind of database whatever you like), like Number of total ball, Number of ball to ball generate, Ball colour code. And then you have to do code for unity to read those parameters from database and do the animation accordingly.

iOS iMessage App Extension - Replicate iMessage Sticker App Behavior

Is there a way to add "real" stickers that behave like Sticker App stickers to your custom iMessage app extension? The only examples I've been able to find use use MSMessageTemplateLayout, which as far as I can tell always shows the app icon and doesn't let you peel the stickers and stick them onto other messages.
"Pealing" is a feature of MSStickerView. In other words, all MSStickerViews can be pealed.
A nice walk-through iMessage Extensions is this Apple Sample code - IceCreamBuilder

Customize iOS Volume HUD in a Unity3D Game

I am currently working on a Unity3D iOS game.I want to override the default Volume View in iOS and implement a custom UI control like in Snapchat and Instagram.
Screenshot:
What you need is low level access to your native iOS application in order to use swift code to disable the volume HUD.
I cannot explain how to do this better than this https://github.com/blitzagency/ios-unity5/blob/master/README.md
Follow the instructions carefully until you are able to setup swift in unity.
Here is a good page on disabling the volume HUD in swift: Hide device Volume HUD view while adjusitng volume with MPVolumeView slider
Hope this helps.

Resources