Posts

Post marked as solved
1 Replies
1k Views
I'm trying to update the colour of an SKEmitterNode within a UIViewRepresentable. The hue value is passed in from the state on the parent View, and the emitter colour should update when the hue value in the parent state updates.It initially displays, and although it updates on the first call to updateUIView it does not respond to any subsequent calls, even though the function definitely gets called with the new value of hue each time.Has anyone any idea why the emitter won't update? I'm at the hair-tearing-out stage... I'd be grateful for any help with this.Here's what I've got. I just can't see what's wrong with this... I'm using the latest XCode GM Seed.import SwiftUI import UIKit import SpriteKit struct EmitterView: UIViewRepresentable { private let view = SKView() let scene = SKScene(fileNamed: "myScene")! var emitter: SKEmitterNode = SKEmitterNode() var hue: Double func makeUIView(context: UIViewRepresentableContext) -> SKView { // Lets make it manually emitter.particleTexture = SKTexture(imageNamed: "spark") emitter.particleBirthRate = 80 emitter.particleLifetime = 2.5 emitter.particlePositionRange = CGVector(dx: 200, dy: 150) emitter.emissionAngle = 90 emitter.emissionAngleRange = 360 emitter.particleRotation = CGFloat(Float(arc4random()) / Float(UINT32_MAX)) emitter.particleRotationSpeed = 0.5 emitter.particleSpeed = 0 emitter.particleSpeedRange = 40 emitter.particleAlpha = 0.8 emitter.particleAlphaRange = 0.2 emitter.particleAlphaSpeed = -0.4 emitter.particleScale = 0.2 emitter.particleScaleSpeed = 0.45 emitter.particleColor = SKColor.blue emitter.particleColorBlendFactor = 1.0 emitter.particleColorSequence = nil; scene.addChild(emitter) view.presentScene(scene) return view } func updateUIView(_ uiView: SKView, context: UIViewRepresentableContext) { let color: SKColor = SKColor( hue: CGFloat(hue), saturation: 1.0, brightness: 1.0, alpha: 1.0 ) print("Hue is now", hue) emitter.resetSimulation() emitter.particleColor = color } } struct EmitterView_Previews: PreviewProvider { static var previews: some View { EmitterView(hue: 0.5) } }
Posted
by raffjones.
Last updated
.
Post not yet marked as solved
1 Replies
2.2k Views
I've been waiting patiently beta by beta for multiline support in the TextField view, to no avail. And I just installed the GM Seed to see it's still not there.I have a UITextField wrapper working as UIViewRepresentable but it seems a ludicrous workaround for such a basic feature.I'm trying this:@State private var text: String = "" var body: some View { TextField("Just a test", $text) .lineLimit(nil) .multilineTextAlignment(.leading) }But yet again, the text field just scrolls along on one line and does not wrap when you hit the end of the line. Explicitly setting the frame does not work either.Am I missing something really simple here, or is this still not supported?
Posted
by raffjones.
Last updated
.
Post not yet marked as solved
3 Replies
1.9k Views
I can get SF Symbols to work fine in main body views.This works:struct ContentView : View { var body: some View { VStack { Text("Hello world") Image(systemName: "square.and.pencil") } } }But this does not - the tab item is emptystruct ContentView : View { @State private var selection = 0 var body: some View { TabbedView(selection: $selection){ Text("Hello world") .tabItemLabel( Image(systemName: "square.and.pencil") ) .tag(0) } } }Is this a known issue?
Posted
by raffjones.
Last updated
.
Post not yet marked as solved
2 Replies
1.3k Views
I have created a separate APFS volume for the beta of macOS 10.15Apple Instructions: "To install a beta (prerelease) version of macOS, enroll in the Apple Beta Software Program and follow the installation instructions on the program website."On the program website, the only option is to "Download the macOS Public Beta Access Utility".Apple Instructions: "When the installer opens and you're asked to choose where to install, click Show All Disks, then select the new volume." However, this does not happen - the installer does not give an option to select the target volume, only to install on my main (Mojave) volume, which I don't want to do. It skips straight over "Destination Select".Whatsmore, it reports "No Time Machine backup detected" despite Time Machine running normally.Has anyone experience this when trying to install on a separate volume?
Posted
by raffjones.
Last updated
.