I’ve applied in SwiftUI the next code:
import SwiftUI
struct onAppearmodifier: View {
@State var mytext: String = "Begin"
let symbols: [String] = ["globe", "heart.fill","house.fill"]
var physique: some View {
NavigationView {
ScrollView {
ForEach(0..<200) { _ in
Rectangle()
.body(width: 200, peak: 200, alignment: .heart)
.padding()
.onAppear {
//name the operate that I wish to construct
}
}
}
.onAppear {
mytext = "Tremendous"
}
}
}
And I wish to construct a operate utilizing stride to point out on canvas each every rectangle an SFSymbolthat I’ve declared above with interval three, and I wish to name this operate inside onAppear() modifier for a particular variety of rectangles. My thought is to implement a operate of a sure sort and to make use of the next block if I’m proper
for index in stride(from: 0, to: symbols.rely, by: 3) {
let symbolGroup = Group {
Picture(systemName: symbols[index])
Picture(systemName: symbols[index + 1])
Picture(systemName: symbols[index + 2])
However I do not know the best way to code it after varied tentatives. I’m caught. Any assist or different suggestion will likely be appreciated.