Posts

Post marked as solved
1 Replies
898 Views
struct Theme: Codable{ &#9;&#9; &#9; var color: Color &#9;&#9;&#9;&#9;var cards:[MemoryGame<CardContent>.Card] &#9;&#9;&#9;&#9;var name:String &#9;&#9;} Here the var color: Color is not going to be Codable. So whats the solution.
Posted Last updated
.
Post not yet marked as solved
0 Replies
339 Views
Hi I want to use the Close Your Ring apple watch app data into my app. Is there any way to save our apple watch data into our database to use it into IOS Apps. I want to save the data when the ring is completed. Please recommend any blog or tutorial to use the Apple Watch Close Your Ring app data into our IOS App. Thanks 😊 :)
Posted Last updated
.
Post marked as solved
5 Replies
301 Views
Hi Guys, I am trying to run the function into the OnAppear and the function runs correctly but the View does not change when the ViewModel values change. ViewModel: import SwiftUI class LocationDetailViewModel: ObservableObject {       @Published var amenities: [Amenity]?   @Published var isLoading: Bool? = true   @Published var error: String?       func fetchAmenities(dbLocation: DBLocation){     Amenity.fetchAmenites(dbLocation: dbLocation) { [weak self] (locationAmenities, error) in       self?.isLoading = false       if error == nil{         print("Success!!!!!!!")         if let locationAmenities = locationAmenities, locationAmenities.count 0 {           self?.amenities = locationAmenities.map{ $0.amenity }         }       }else{         print("Error!!!!!!!!!")         self?.error = error?.localizedDescription       }     }   } } View: import SwiftUI import SDWebImageSwiftUI import MapKit struct LocationDetailView: View {       let dbLocation: DBLocation   @State private var isPresentingSaveToCollection: Bool?   @State private var isPresentingToast: Bool?   @State private var toastText: String?   @ObservedObject var locationDetailViewModel = LocationDetailViewModel()   let defaultImageUrl: String       var body: some View {     GeometryReader{ geometry in       VStack{         if locationDetailViewModel.isLoading ?? true {           VStack(alignment: .center){             InProgressView()           }.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height, alignment: .center)         }else{           LocationView(dbLocation: dbLocation, defaultImageUrl: defaultImageUrl, isPresentingSaveToCollection: $isPresentingSaveToCollection)             .environmentObject(locationDetailViewModel)             .padding(.top, geometry.safeAreaInsets.top)             .background(SwiftUI.Color( colorLiteral(red: 0.9644473195, green: 0.9684088826, blue: 0.9848803878, alpha: 1)))             .edgesIgnoringSafeArea([.top, .horizontal])         }       }             }     .onAppear{       locationDetailViewModel.fetchAmenities(dbLocation: dbLocation)     }     .navigationBarHidden(true)     .fullscreenModal(isShowing: $isPresentingSaveToCollection) {       SaveToCollectionView(isPresentingSaveToCollection: $isPresentingSaveToCollection, isPresentingToast: $isPresentingToast, toastText: $toastText)     }.toast(isShowing: $isPresentingToast, message: toastText ?? "Undefinded Toast")   } }
Posted Last updated
.