Hello,
I'm working on a reference / informational style app and I'm not sure what the correct practice is for storing a lot of data thats predetermined and unlikely (but possible) to change.
A good example of something similar to what I'm working on is a wikipedia page - https://en.wikipedia.org/wiki/Water.
Let's say I built a struct for managing this data, and all of the information above is can be broken down and placed into the struct for use.
Currently, I have all of this information in different files and as global constants.
Water.swift
let water = MyStruct(...)
Ice.swift
let ice = MyStruct(...)
Steam.swift
let steam = MyStruct(...)
Currently it's working fine. However I'm planning on having over 500 different files / constants filled with data once the app is fully built.
My questions are:
Is having a large amount of global constants bad? (even though they are lazy)
Whats the best practice for storing this data?
Note:
I did come across this SwiftUI tutorial by Apple - https://developer.apple.com/tutorials/swiftui/building-lists-and-navigation#Get-to-Know-the-Sample-Data and it's also a good example of what I'm trying to accomplish. What they did inside of it is wrapped up the data in JSON, and then had a codable struct to match it to. Would that be a better approach?
Post
Replies
Boosts
Views
Activity
Hello,
I have a tableView Cell that's setup to display a graph. This is done by having a 1:1 UIImageView displaying a UIImage of a graph I created.
I've got code that calculates where to create a second UIImageView to show the data plot on the graph, using the imageView bounds to determine the position.
The problem I'm having is that there appears to be an issue with the constraints. And I can't figure out how to fix.
I've tried multiple different ways to set this up. Currently I have UIView (subView) inside of the container view. the subView is pinned to 40 from the super view on all sides, had a 1:1 aspect ratio, and is centered X and Y on the containerView.
Then inside of this subView, there is a UIImage of the graph pinned 0 on all sides.
The image loads correctly. However, I plotted UIImages in each corner to see where the bounds / frame are, and these appear to be loading incorrectly. - Which is causing the point to plot wrong initially on load. But then does correct itself once it's reloaded. Either by calling the cell to reload directly, by when its dequeued and reloaded.
I'm not sure how to load photos here, but I had a thread on StackOverflow as well that has pictures of the issue here:
https://stackoverflow.com/questions/62925314/tableview-cells-resizing-auto-layout-issue-on-load-but-fixes-after-second-rel?noredirect=1#comment111330305_62925314
Any help on fixing these constraint issues would be greatly appreciated!
Thank you!
Hello,
I’m playing around with making an fully immersive multiplayer, air to air dogfighting game, but I’m having trouble figuring out how to attach a camera to an entity.
I have a plane that’s controlled with a GamePad. And I want the camera’s position to be pinned to that entity as it moves about space, while maintaining the users ability to look around.
Is this possible?
--
From my understanding, the current state of SceneKit, ARKit, and RealityKit is a bit confusing with what can and can not be done.
SceneKit
Full control of the camera
Not sure if it can use RealityKits ECS system.
2D Window. - Missing full immersion.
ARKit
Full control of the camera* - but only for non Vision Pro devices. Since Vision OS doesn't have a ARView.
Has RealityKits ECS system
2D Window. - Missing full immersion.
RealityKit
Camera is pinned to the device's position and orientation
Has RealityKits ECS system
Allows full immersion