I am able to obtain daily forecasts via the REST API which include the daytimeForecast and overnightForecast records with their respective properties like cloudCover.
So far I have failed to access them via the Swift API:
forecast.daytimeForecast.cloudCover
results in: "Value of type 'DayWeather' has no member 'daytimeForecast'".
But if I print() the DayWeather objects, these members are actually printed with all their properties.
Is there a way to get them I am overlooking?
Post
Replies
Boosts
Views
Activity
Hi! While waiting for scene understanding to work in the visionOS simulator, I am trying to bounce a virtual object off a real world wall or other real world object on iOS ;). I load my virtual objects from a Reality Composer file where I set them to participate in physics with dynamic motion type.
With this I am able to have them collide with each other nicely, occlusion also works, but they go right through walls and other real world objects rather than bouncing off...
I've tried a couple of variations of the following code:
func makeUIView(context: Context) -> ARGameView {
arView.environment.sceneUnderstanding.options.insert(.occlusion)
arView.environment.sceneUnderstanding.options.insert(.physics)
arView.debugOptions.insert(.showSceneUnderstanding)
arView.automaticallyConfigureSession = false
let config = ARWorldTrackingConfiguration()
config.planeDetection = [.horizontal, .vertical]
config.sceneReconstruction = .meshWithClassification
arView.session.run(config)
if let myScene = try? Experience.loadMyScene() {
...
arView.scene.anchors.append(myScene)
}
return arView
}
I have found several references that his should "just work", e.g. in https://developer.apple.com/videos/play/tech-talks/609
What am I missing? Testing on iPhone 13 Pro Max with iOS 16.5.1 🤔
Hi!
despite the documentation saying otherwise, MultipeerConnectivityService appears to be unavailable in visionOS. Am I missing something or is this an issue with the current beta or (hopefully not 😬) the documentation?
https://developer.apple.com/documentation/realitykit/multipeerconnectivityservice
do {
entity.scene?.synchronizationService = try MultipeerConnectivityService(session: MultipeerSession.shared.session)
print("RealityKit synchronization started.")
} catch {
fatalError("RealityKit synchronization could not be started. Error: \(error.localizedDescription)")
}
Xcode complains 'MultipeerConnectivityService' is unavailable in visionOS, while the scene's synchronizationService property can be accessed...
Hi!
I am getting all debug output in text only format, without structure or color. I only noticed now after watching the respective WWDC session in Xcode 15 beta 8, but I am pretty sure this was the case in the previous betas as well. Is the new structured debug console activated by some setting I am overlooking?
Hi!
I was able to setup Xcode Cloud and build manually without problems. Also, GitHub integration with Xcode works, I can commit and push changes to my GitHub repo.
Unfortunately, I am not able to trigger a Xcode Cloud build by pushing changes to my repo. Tried git push via Xcode 15.2 and via command line. The push itself always works.
I was under the impression this should "just work", if the workflow includes a start condition set to Branch Changes, Any Branch, no custom conditions. I have one single branch.
Fails silently, no visible activity, neither in Xcode nor in the App Connect portal.
Any ideas? Am I missing something?
Best regards
Today I have tried to add a second archive action for visionOS. I had added a visionOS destination to my app target a while back and can build and archive my app for visionOS in Xcode 15.3 locally, and also run it on the device.
Xcode Cloud is giving me the following errors in the Archive - visionOS action (Archive - iOS works):
Invalid Info.plist value. The value for the key 'DTPlatformName' in bundle MyApp.app is invalid.
Invalid sdk value. The value provided for the sdk portion of LC_BUILD_VERSION in MyApp.app/MyApp is 17.4 which is greater than the maximum allowed value of 1.2.
This bundle is invalid. The value provided for the key MinimumOSVersion '17.0' is not acceptable.
Type Mismatch. The value for the Info.plist key CFBundleIcons.CFBundlePrimaryIcon is not of the required type for that key. See the Information Property List Key Reference at https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009248-SW1
All 4 errors are annotated with "Prepare Build for App Store Connect" and I get them for both "TestFlight (Internal Testing Only)" and "TestFlight and App Store" deployment preparation options.
I have tried to remove the visionOS destination and add it back, but this is not changing the project at all.
Any ideas what I am missing?
Hi!
It seems that Xcode 16 beta 2 thinks that EnvironmentResource.generate(fromEquirectangular:) is unavailable even when the minimum target remains set to visionOS 1.0 (it is deprecated but Xcode reports a build error). The only way I was able to keep this in place for visionOS 1.x while compiling with Xcode 16 was the following:
var environment: EnvironmentResource?
if #available(visionOS 2.0, *) {
environment = try? await EnvironmentResource(equirectangular: skyBoxWithSun())
} else {
fatalError("EnvironmentResource.generate(fromEquirectangular:) does not compile with Xcode 16.0 beta 2.")
}
#else
let environment = try? await EnvironmentResource.generate(fromEquirectangular: skyBoxWithSun())
#endif
This will build with both Xcode 15.4 and 16 beta 2, but obviously crash when built with Xcode 16 and run on visionOS 1.x Do I have any better options? I would like to add some visionOS 2.0 features (e.g. try to replace my custom skybox with the new dynamic lighting) but prefer to maintain backward compatibility for now.
While working with the Emoji Rangers Sample Code, I noticed that .redacted(reason:) seems to ignore the minimumScaleFactor() modifier - I have reproduced this behaviour with Xcode 16 and Xcode 16.1 beta 2 on iOS and on the Mac:
struct ContentView: View {
@State private var isRedacted: Bool = false
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
.font(.largeTitle)
Toggle("Redacted", isOn: $isRedacted)
}
.padding()
.minimumScaleFactor(0.1)
.redacted(reason: isRedacted ? .placeholder : .invalidated)
}
}
As long as the minimumScaleFactor does not kick in, redacted seems to work as expected:
But then it does not:
I tried changing the order of both modifiers with no effect. Wonder if this is expected and there is a way to make it work so it preserves the scaled down layout or a bug?
Filed just in case: FB15270541 (.redacted(reason:) modifier ignores .minimumScaleFactor)
While I am able to use #Preview to preview a Widget, it seems to be not possible to easily preview a Widget placeholder. With a "classic" preview I can use .redacted(reason: .placeholder), but this has limitation e.g. it will ignore .contentMarginsDisabled()
struct MyWidget_Previews: PreviewProvider {
static var previews: some View {
Group {
MyWidgetView(entry: SimpleEntry(date: .now, emoji: "😀"))
MyWidgetView(entry: SimpleEntry(date: .now, emoji: "😀"))
.redacted(reason: .placeholder)
}
.previewContext(WidgetPreviewContext(family: .systemMedium))
.containerBackground(.white, for: .widget)
}
}
If I use #Preview, the .redacted modifier won't work, and I seem to have to put it in the MyWidget implementation.
#Preview(as: .systemMedium) {
MyWidget()
} timeline: {
SimpleEntry(date: .now, emoji: "😀")
SimpleEntry(date: .now, emoji: "🤩")
}
Am I missing something?
Hi!
I have some unit tests which send and receive local notifications. Unfortunately, when ran on Xcode Cloud, the tests time out. I assume due to a call to requestAuthorization in init() (I have started using Swift Testing).
Is there a way to get around this issue in order to run the tests?
Hi!
When my device is set to English, both search and the Shortcuts up automatically show multiple shortcuts parametrised for each value of the AppEnum - which is what I expected. When my device is set to German, I get only the basic AppShortcut without the (optional) parameter.
I am using an AppEnum (see below) for the parametrised phrases and localise the phrases into German with an AppShortcuts String Catalog added to my project.
Everything else seems to work, I can use my AppShortcut in the Shortcuts app and invoke it via Siri in both English and German.
The Shortcuts app displays the values correctly using the localized strings.
Any ideas?
import AppIntents
class ApolloShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: GetIntent(),
phrases: [
"Get data from \(.applicationName)",
"Get data from \(.applicationName) for \(\.$day)",
"Get data from \(.applicationName) for the \(\.$day)"
],
shortTitle: "Get Data",
systemImageName: "wand.and.sparkles")
}
}
enum ForecastDays: String, AppEnum {
static var typeDisplayRepresentation: TypeDisplayRepresentation = "Day"
static var caseDisplayRepresentations: [Self : DisplayRepresentation] = [
.today: DisplayRepresentation(title: LocalizedStringResource("today", table: "Days")),
.tomorrow: DisplayRepresentation(title: LocalizedStringResource("tomorrow", table: "Days")),
.dayAfterTomorrow: DisplayRepresentation(title: LocalizedStringResource("dayAfterTomorrow", table: "Days"))
]
case today
case tomorrow
case dayAfterTomorrow
var displayName: String {
String(localized: .init(rawValue), table: "Days")
}
}