Hi
Im copying the Apple tutorial project for lists and navigation for SWiftUI but Im getting an error although my code is same as Apple project, can some one check please.
Error
"Cannot find 'landmarks' in scope"
Kindest Regards
import SwiftUI
struct LandmarkRow: View {
var landmark: Landmark
var body: some View {
HStack {
Text(landmark.name)
}
}
}
struct LandmarkRow_Previews: PreviewProvider {
static var previews: some View {
LandmarkRow(landmark: landmarks[0])
}
}
import Foundation
import SwiftUI
import CoreLocation
struct Landmark: Hashable, Codable {
var id: Int
var name: String
var park: String
var state: String
var description: String
private var imageName: String
var image: Image {
Image(imageName)
}
private var coordinates: Coordinates
var locationCoordinate: CLLocationCoordinate2D {
CLLocationCoordinate2D (
latitude: coordinates.latitude,
longitude: coordinates.longitude)
}
struct Coordinates: Hashable, Codable {
var latitude: Double
var longitude: Double
}
}
Post
Replies
Boosts
Views
Activity
Hi ..
The up and down new icons isn't nice please change them and make them smaller .
Kindest Regards
Hi ..
Is SwiftUI still in beta ? how regular it get updates ? only in WWDC ?
Kindest Regards
Hi ..
When creating new SwiftUI project in Xcode 12 Beta 2 the selection box for Core Data and iCloud is disabled ? why is that is it because it's beta or not supported by SwiftUI ?
Kindest Regards
Hi ..
When I click the live preview button in a SwiftUI project nothing happens ?
Kindest Regards
Hi
In struct ContentView_Previews the static var previews why it's acting like a function ? and why its calling the sturct ContentView () as if it was a function not a struct ?
Kindest Regards
Hi
When creating new SwiftUI App we get the struct below in the ContentView.Swift file, but as I know sturct can't inherit or I missed something here ? and whats the word some means ? its not the struct name or the parent struct so whats its used for ?
struct ContentView: view {
ver body: some view {
Text ( "Hello World" )
}
}
HiIs it possible to program Python in Xcode ? and haw about HTML, CSS, JavaScript ?--Kindest Regards
Hi ..Im working on CloudKit, I made new iOS project and added a CloudKit Capability, as well as a container, imported it in a View Controller and tried to save data as code below, but nothing is happeing and no data is being saved when I go to the dashboard ?@IBAction func addReport(_ sender: Any) {
let bugReport = CKRecord(recordType: "NewReport")
bugReport ["BugName"] = "Bug 1"
bugReport ["BugDisc"] = "Its a main bug"
let container = CKContainer.default()
let database = container.publicCloudDatabase
database.save(bugReport) {(savedRecords, error) in
}
}
HiView Controller in Stoyroard has a First Responder & Exit sort of buttons or controls at the top, whats there used for ? and is there any examples for this usage or scenarios ?--Kindest Regards
HiI saw a strange sugeues I see first time, where the destination view controllers are like icons cause they are in another stody board, how this can be done in a story board not programatically same as in photo below ? and haw it can be done in code ?h ttps://www.dropbox.com/s/nvl857**3r6ijap/Screen%20Shot%202020-04-29%20at%2012.17.11%20AM.png?dl=0--Kindest Regards
HiI dowloaded simulator 13.3 and I managed to remove its devices from window menu, but Im trying to remove the component from Xcode components but theres no delete option so from wheer I can delete it ?--Kindest Regards
HiIn this quick demo the first line as I understand is enouch to change the image of file, why he needed to use the second line the one with CGPoint.zero ? it doesnt make sense to me ?--Kindest Regardsh ttps://www.youtube.com/watch?v=rnJxpuPyLNA
Hisuppose I want an attribute to hold a unique number auto generated for each record in an entity in core Data, is there something out of the box in core Data to use ?--Kindest Regards
Hihi is there a property to sent an attribute of an entity as unique that doesn't accept same value in two records ? And if yes an that be done when doing the modeling say like a check box ?--Kindest Regards