My Mac isn’t compatible with Big Sur, and I just started learning Swift and SwiftUI. Is it possible to develop apps on the latest iPadOS beta on macOS Catalina?
Post
Replies
Boosts
Views
Activity
I have a late 2012 iMac running Catalina. I find it really weird that Xcode 12 runs slowly because I can run Xcode 11 fine. It takes forever to build (around 2 minutes), simulate (around 5 minutes), and preview (around 3 minutes) on Xcode 12. Heck, I don’t even bother to toggle the live preview option. But, this wasn’t the case when I still used Xcode 11.
Will Apple be dropping support for older iMacs? How can I make it run faster?
Specs:
i5 3.2 Ghz Quad-Core
8 GB RAM 16MHz DDR3
1 TB storage
GTX 675MX 1 GB
I just want to share it with them. My app is nothing serious. It's just for fun.
Why am I getting this error? There's another post similar to this, but it doesn't have any answers.
import SwiftUI
struct ContentView: View {
@State var clicked = 0
var numberValue = [1: "won", 9: "Nein!", 69: "nice.", 123: "321", 666: "ILLUMINATI", 6969: "very nice."]
func addOne() {
clicked += 1
print(clicked)
}
var body: some View {
VStack{
Text("Clicker: The Game")
.font(.largeTitle)
.fontWeight(.bold)
.multilineTextAlignment(.center)
.offset(y: -225)
Text(numberValue[self.clicked] ?? String(self.clicked))
.font(.system(size: 69))
.offset(y: -125)
Button(action: addOne) {
Text("Tap me!")
.offset(y: -10)
.font(.system(size: 30))
.background(RoundedRectangle(cornerRadius: CGFloat, style: RoundedCornerStyle = .circular))
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
I can modify the toolbar thing on projectname.storyboard, but I can't find a way to edit the window that pops up when I click "About app name"
I get no error if my code is this
ForEach((1...10), id: \.self) {
Text("\($0)")
}
But, if I change the \($0) to something else, like "bruh" or "\($variableName), it won't work. It gives me 5 errors
"Cannot convert value of type 'ClosedRange<Int>' to expected argument type 'Range<Int>'
Cannot infer key path type from context; consider explicitly specifying a root type Insert '<#Root#>
Extra arguments at positions #2, #3 in call
Generic parameter 'Content' could not be inferred Explicitly specify the generic arguments to fix this issue
Missing argument for parameter 'context' in call Insert ', content: <#(Int) -> _#>'
ScrollView(.horizontal, showsIndicators: false) {
Image("sandwich0")
.resizable()
.frame(width: 100.0, height: 100.0)
Image("sandwich1")
.resizable()
.frame(width: 100.0, height: 100.0)
Image("sandwich2")
.resizable()
.frame(width: 100.0, height: 100.0)
}
Relevant code ^
My ScrollView isn't horizontal. It's vertical, but you can swipe horizontally. I can't upload an image here because I can't link to Imgur for some reason.
My code:
Text("alpha")
.font(.subheadline)
.background(RoundedRectangle(cornerRadius:
.strokeBorder(lineWidth: 1))
It works as expected, but there's no space between the border and the text.
I always get errors whenever I use the normal for loop and the repeat loop.
I have 2 files that I want to work together or something.
The first is the main file: ContentView.swift. The second is the file where my other view is: KeysView.swift.
This is what KeysView contains:
struct KeysView: View {
var body: some View {
HStack {
Button(action: {
}) {
Text("1")
.padding()
.background(Color.black)
.clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/)
}
Button(action: {
}) {
Text("2")
.padding()
.background(Color.black)
.clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/)
}
Button(action: {
}) {
Text("3")
.padding()
.background(Color.black)
.clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/)
}
}
HStack {
Button(action: {
}) {
Text("4")
.padding()
.background(Color.black)
.clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/)
}
Button(action: {
}) {
Text("5")
.padding()
.background(Color.black)
.clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/)
}
Button(action: {
}) {
Text("6")
.padding()
.background(Color.black)
.clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/)
}
}
HStack {
Button(action: {
}) {
Text("7")
.padding()
.background(Color.black)
.clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/)
}
Button(action: {
}) {
Text("8")
.padding()
.background(Color.black)
.clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/)
}
Button(action: {
}) {
Text("9")
.padding()
.background(Color.black)
.clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/)
}
}
}
}
In ContentView, I'm trying to call the view using KeysView(), but I keep getting a Cannot find 'KeysView' in scope error.
I'm confused. If I get an error, I just replace it with the other and it just works, but what I don't know is why it works. Both share the same value with the variable they're bonded to, so what's the difference?
var sum: Double {
let peopleCount = Double(numberOfPeople + 2)
let tipSelection = Double(tipPercentages[tipPercentage])
let orderAmount = Double(checkAmount) ?? 0
return orderAmount / peopleCount * tipSelection
}
Is this a function, a variable, or both?
@State private var menuItems = ["Heroes", "Items", "Tips"]
var body: some View {
ZStack {
VStack {
ForEach(0 ..< menuItems.count) {_ in
Button(action: {}) {
Text("\(menuItems[$index])")
.foregroundColor(Color.white)
}
.padding(.horizontal, 75.0)
.padding(.vertical, 25.0)
.background(Color.gray)
}
}
}
I get an "Cannot find '$index' in scope"
Is it stuck on portrait mode? There's no option that lets me change the orientation.
Is GM seed the final beta or something?