when I use @State var show = false in RegisterFirstScreen, it fix error.
I forget put the () end of the signUp
self.viewModel.signUp()
Post not yet marked as solved
here some example but I do not know how I will add two delete method to one .alert dialog
struct AlertInfo: Identifiable {
enum AlertType {
case one
case two
}
let id: AlertType
let title: String
let message: String
}
struct ContentView6: View {
// 2
@State private var info: AlertInfo?
var body: some View {
VStack {
Button("Alert 1") {
// 3
info = AlertInfo(
id: .one,
title: "Title 1",
message: "Message 1")
}
Button("Alert 2") {
// 4
info = AlertInfo(
id: .two,
title: "Title 2",
message: "Message 2")
}
}
.alert(item: $info, content: { info in // 5
Alert(title: Text(info.title),
message: Text(info.message))
})
}
}
I forget to add value after .spring(), it is work for me now.
@Binding var display: Bool
private var background: some View {
Color.black
.fillParent()
.opacity(0.6)
.animation(.spring(), value: display)
}
Post not yet marked as solved
HStack{
Text(data.user)
.searchable(text: $searchText, placement: .navigationBarDrawer)
.font(.caption)
.foregroundColor(.black)
}
model:
struct Recent: Identifiable {
var id = UUID().uuidString
var user: String
}
let data= [
Recent(user: "skysoft1"),
Recent(user: "skysoft2"),
Recent(user: "skysoft3"),
]
As OOPers and Claude mentions in comment, when we called the TabView as MyTabView problem solved
on line 2 I get error, in TabView , and how onboardingData and OnboardingCard are defined it is defined as
OnboardingCard:
fileprivate struct OnboardingCard: View {
let onboardingItem: OnboardingItem
var body: some View {
VStack {
Image(onboardingItem.imageName)
.resizable()
.frame(width:340, height:340)
Text(onboardingItem.title)
.font(.title)
.foregroundColor(.black)
.bold()
.padding()
Text(onboardingItem.description)
.multilineTextAlignment(.center)
.font(.body)
.foregroundColor(.gray)
.padding (.horizontal, 15)
}
}
}
onboardingData:
var onboardingData: [OnboardingItem] = [
OnboardingItem(imageName: "image1", title: "Welcome1", description: "description1"),
OnboardingItem(imageName: "image2", title: "Welcome2", description: "description2"),
OnboardingItem(imageName: "image3", title: "Welcome3", description: "description3"),
OnboardingItem(imageName: "image4", title: "Welcome4", description: "description4")
]
I had a $(inherited) but recursive, just change it to non-recursive
project target -> build settings -> framework_search_path
İtems inside of the Hstack, not align.
HStack {
Text(i.name)
.frame(width:100)
.padding()
GeometryReader { g in
HStack{
Spacer(minLength: 0)
Rectangle()
.fill(i.color)
.frame(width: self.getWidth(width: g.frame(in: .global).width, value: i.percent) ,height: 10)
Text(String(format: "\(i.percent)", "%.0f"))
.fontWeight(.bold)
.padding(.leading,10)
.frame(width:80)
Spacer()
}.frame(width: 240, height: 30)
}
}
Here, rest of the code
struct Pie: Identifiable {
var id : Int
var percent : CGFloat
var name : String
var color : Color
}
struct DrawShape: View {
var center: CGPoint
var index: Int
var body: some View {
Path {path in
path.move(to: self.center)
path.addArc(center: self.center, radius: 180, startAngle: .init(degrees: self.from()), endAngle: .init(degrees: self.to()), clockwise: false)
}
.fill(data[index].color)
}
func from () - Double {
if index == 0 {
return 0
}
else {
var temp: Double = 0
for i in 0...index-1 {
temp += Double(data[i].percent/100)*360
}
return temp
}
}
func to() - Double {
var temp: Double = 0
for i in 0...index {
temp += Double(data[i].percent / 100) * 360
}
return temp
}
}
var data = [
Pie(id:0, percent: 10, name: "news", color: Color("Black")),
Pie(id:1, percent: 90, name: "sport", color: Color("Blue"))
]
Post not yet marked as solved
tnx, I try but nothing change
Post not yet marked as solved
I put VStack to where, if u show , I will be appreciated.
Post not yet marked as solved
yes ,I put in xcassets icons, even ı was chabge with different icons. I guess it is commulated in list view with text. I do not know how solve it
Post not yet marked as solved
Tnx so much , I have intent to use it for settings menu in medicine app, for example in settings list menu I have items like that, Account, Appearance, Notifications, Contact us.. that is why I need new view for every items. If you consider for contact apps, yes I agree it is not good idea. I do not know can I use ur solution for my medicine app?
Post not yet marked as solved
tnx so much for ur answer, I mean for example u have four list items, like NumberOne, NumberTwo, NumberThree, NumberFour, when You click any items, it can route new view like NumberOneView, NumberTwoView, NumberThreeView, NumberFourView. Hope it is clear :)
Post not yet marked as solved
yes definitely, for every items, new view :)