I was studying swiftUI at SwiftUI Tutorials.
On the way, the preview of swiftUI is in a state where the preview does not open with the error "cannot preview in this file --Failed to install".
open the Diagnostics
FailedToInstallAppError: Failed to install "appname.app"
Could not install the preview host "appname.app" on iphone8
I get the error
I created a new project and tried it, but I get the same error.
Did the settings change?
I would like advice on how to deal with it.
Post
Replies
Boosts
Views
Activity
I'm using SwiftUI
I want to object is call by reference when the screen transitions from ContentView to RemoteController
@ObservedObject became an error with "Cannot assign to property:'self' is immutable"
I want to use the same object for both ContentView and RemoteController
Is there any solution?
Below is the code
struct ContentView: View{
@State var Object : Controller?
@ObservedObject var inputObject : SDController
var body: some View{
NavigationView{
VStack{
Button(action: {
Object = Controller.init(postEventsToMain: true)
inputObject = Object! // error "Cannot assign to property:'self'is immutable"
})
NavigationLink(
destrination: RemoteController()){
RemoteController().environmentObject(inputObject)
}
}
}
}
struct RemoteController:: View{
@EnvironmentObject private var inputObject : Controller
var body: some View{
........
}
}
class Controller: ObservableObject{
........
init(postEventToMain : Bool = true){
.........
}
}
I need to use UnsafeMutablePointer <> to use a third party API.
I'm using swift to create an iOS app.
I use after declare, I was told that initialization was needed.
after initialize, i Get a Error "Editor placeholder in source file".
How should I initialize it?
Below is a code.
var value : UnsafeMutablePointer
value.initalize(from; UnsafePointer , count: NumberOfArray) // I get an error hear.
at iOS.
In Swift,I'm thinking of launching an app using a URL scheme
UIApplicatio.shared.open(URL(string:"AppURLSchemeName"))
I get a Error.
Error: Domain = NSOSStatusErrorDomain Code = -50 "invalid input parameters" UserInfo=`{NSDebugDescription = invalid input parameters,_LSLine =249, _LSDLine = 249, __LSFunction = _LSDOpenClient openURL:filehandle:options: completionHandler }
the environment is
macOS Ventura 13.0
XCode vertion 14.0.1
iPhone 13 mini
iOS 16.1
what's the issue
I want to change the value with a slider control.
slider(value: $value)
...
...
...
value = 1
Can't change slider value when debugging.
slider value want to change
and
I want to change it by user's operation.
how to do?