@Claude31, I can, but the nearest authorized Apple service something is too far away. Should I buy a new Mac instead?
Also, Xcode 11 works fine.
Post
Replies
Boosts
Views
Activity
Good to know that I'm not the only one that has this problem.
@OOPer
import SwiftUI
struct ContentView: View {
@State private var showingSheet = false
var body: some View {
ZStack{
VStack{
Text("Reference Buddy :D")
.font(.title)
.fontWeight(.bold)
HStack{
Button("Physics") {
self.showingSheet.toggle()
}
.sheet(isPresented: $showingSheet) {
physicsPage()
}
Button("Trigonometry", action: {})
Button("Calculus", action: {})
}
HStack{
Button("Pre-calculus", action: {})
Button("Geometry", action: {})
Button("Statistics", action: {})
}
HStack{
Button("Chemistry", action: {})
Button("Biology", action: {})
Button("Astronomy", action: {})
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
struct physicsPage: View {
@Environment(\.presentationMode) var presentationMode
var body: some View {
VStack{
Text("Did you know that...")
ForEach((1...10), id: \.self) {
Text("\($showingSheet)")
}
Button("Back") {
self.presentationMode.wrappedValue.dismiss()
}
}
}
}
@OOPer, thank you so much. I found a fix.
ForEach((1...10), id: \.self) {
Text("\($showingSheet)")
}
This doesn't work because showSheet is not in the same struct and also private.
After reading your answer, I changed my code to this:
ForEach(0..<10) {_ in
Text("Hello")
}
The _ in part is required. If I remove that, I'l get an Contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored error.
If I changed (0..<10) to (0...10), I get this error:
Cannot convert value of type 'ClosedRange<Int>' to expected argument type 'Range<Int>'
Thank you so much :D
I have to build and run it. After that, the canvas works fine.
Thanks, OOPer. Do we know when this update will be released?
@2012jacky, sure.
//
// ContentView.swift
// MinimalisticCalculator
//
// Created by Joe Mama on 10/6/20.
//
import SwiftUI
struct ContentView: View {
@State private var darkMode = false
var body: some View {
ZStack{
if darkMode {
Color.black
.ignoresSafeArea()
} else {
}
VStack{
KeysView()
HStack {
Button(action: {
self.darkMode.toggle()
}) {
if darkMode {
Image(systemName: "moon.fill")
} else {
Image(systemName: "moon")
}
}
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
With $ you access a var that has been declared as @State. With self you access a "basic" var Haha. I can't believe I didn't notice that. Thanks a lot!
Are you still experiencing this problem? I know it's been 3 months already, but I'm just curious
You can try downloading the latest beta of Xcode (Xcode 12.2 Beta 2). If that doesn't solve the problem, try building and running the app first, then wait until it finishes building. After the app gets launched in the simulator, close the simulator window and click "resume" on the canvas page.
Thanks, Claude31. This computed variable thing is new to me.
There are answers here - https://stackoverflow.com/questions/56517813/how-to-print-to-xcode-console-in-swiftui
Can you show us your code?
@OOPer, thanks. Lol. I can't believe I didn't notice that 😅
Thanks, Frameworks Engineer!
Thanks for the reply, but it's not that (but thanks for that because it's interesting). I want to do something like the drop down sections or something in Files. They're the "Locations", "Favorites", and "Tags" drop down section things.