Receive messages code

This commit is contained in:
Garth Vander Houwen 2021-09-28 00:00:09 -07:00
parent 50c3b17768
commit 28bdd7a39a
6 changed files with 56 additions and 7 deletions

View file

@ -22,11 +22,11 @@ class MessageData: ObservableObject {
func load() {
DispatchQueue.global(qos: .background).async { [weak self] in
guard let data = try? Data(contentsOf: Self.fileURL) else {
//#if DEBUG
#if DEBUG
DispatchQueue.main.async {
self?.messages = MessageModel.data
}
//#endif
#endif
return
}
guard let messageList = try? JSONDecoder().decode([MessageModel].self, from: data) else {

View file

@ -52,7 +52,7 @@ struct NodeInfoModel: Identifiable, Codable {
}
}
var coordinate: CLLocationCoordinate2D? {
if latitude != nil || longitude != nil {
if latitude != nil && longitude != nil {
let coord = CLLocationCoordinate2D(latitude: latitude!, longitude: longitude!)
return coord