Wow, that works. Thank you! So basically I just had to include a uiImage: which wasn’t in the original code and add your three line to get the image to display properly.
Took me some try and error - because some of the code displays as a thumbnail and I had to figure out which code to include and which is included in the [Thumb].
When I copy&paste my working code here it looks like this:
struct CircleImage: View {
var body: some View {
Image(uiImage: imageLiteral(resourceName: "Foto.png"))
.resizable()
.frame(width: 200, height: 200)
.clipShape(Circle())
}
}
in the playground App the line Image(uiImage.... looks like this:
Image(uiImage: [Thumbnail]) Thanks again, big help!
Post
Replies
Boosts
Views
Activity
Very helpful! Thank you.
I tried to remove all Watches from the iPhone Simulators. Doesn't work.
I can run the Project in iOS Simulator and Watch Simulator just fine. I can run the Project on iOS and WatchOS Devices just fine.
Previewing iOS and WatchOS side by side in the same preview canvas would really be a nice addition.
I have a workaround: pinned preview.
Tested with a sample custom view in shared group:
struct CustomTextView: View {
let caption: String
let foreground: Color
var body: some View {
VStack {
Text(caption)
.padding()
Text("Colored\r" + caption)
.foregroundColor(foreground)
.padding()
}
}
}
//struct CustomTextView_Previews: PreviewProvider {
// static var previews: some View {
// CustomTextView(caption: "Shared Preview", foreground: .blue)
// }
//}
And a preview container inside the WatchkitExtension:
struct CustomTextViewWatchPreview: View {
var body: some View {
CustomTextView(caption: "Watch Preview Wrapper", foreground: .red)
}
}
struct CustomTextViewWatchPreview_Previews: PreviewProvider {
static var previews: some View {
CustomTextViewWatchPreview()
}
}
Then when previewing Watch just pin this preview and modify the CustomTextView. The (iOS) Preview inside the CustomTextView .swift file should be commented out at this time.
It's not ideal but at least it kinda works.
Thank you very much for your profound answer!
It seems we have encountered different problems with the same error message?
I have not posted my full code, but the main difference between yours and mine is that Consts.myCondition is never changed after compiling. I originally wanted to do a #ifdef but I found that's not supported by swift. Just now I read about Build Configurations - will have to look into this.
At least it seems more and more clear that it's not my understanding of SwiftUI that's at fault here... like you said if I can find the time I'll post a bug report.
Thank you for your reply. That's a good start and I'll use it for now. Maybe later I can think of a way to increase the timer intervals - like when the update was hours ago then I'll set the interval to 1 minute or something.
Strange: in Swift Playgrounds it doesn't work (the timer doesn't fire at all, but the relDateText is set to the initial interval.) Probably a quirk of Playgrounds, I guess.
In Xcode Previews it only works in "live" preview which is as expected. Couldn't find a quick way to fix that other than hardcode an initial value instead of "".
In Simulator it works quite well. I didn't try onDevice yet but why would it fail there?
I am assuming iPhone app.
Go to Health app, then your data type, scroll down to "Data Sources & Access". Make sure your app is enabled in the read section.
tap edit in the upper right corner (navigation bar)
scroll down to "data sources" section and make sure your app is marked with a checkmark. If it isn't checked tap on your list row to add the checkmark. Tap done in the navigation bar.
If you're talking about watchOS my suggestion is to do it on the iPhone like above but I'm not 100% sure it will work...
Hope it helps!
My thought, exactly.
I have just done it: downloaded 13 Beta, unpacked it and ran it right there. It didn't really "install" anything as far as I can tell, Xcode 12 seems to run unchanged. So I guess it just works as easy as this.
Could someone else please confirm that's the way it's supposed to be done? Am I missing something?
You need to get the uuid of the sample in the health database and delete that sample by its uuid.
See delete(_:withCompletion:)
Thank you edford. That’s what I was looking for.
Apparently this has been fixed by iOS 15 Beta 4: on my test device I had the error prior to the Beta 4 update, using a test app compiled with Xcode 13 Beta 3. After the update to iOS 15 Beta 4 the error is gone. (Xcode Beta 4 is still downloading currently.)
So I think it’s reasonable to say that the update to iOS 15 Beta 4 did fix the error.
Apple Feedback ID FB9063694
If any1 would like to confirm…?
This line
@StateObject var graph = graphData()
initializes a new graph instance in either of your views. They don't communicate with each other.
Better use
@ObservedObject var graph = GraphData.shared
in the views and
class GraphData: ObservableObject {
static let shared = GraphData()
...
}
in your model class.