Post

Replies

Boosts

Views

Activity

Build Error due o info.plist
this is the error I'm getting building the project Build input file cannot be found: '/Users/nsame/Desktop/Xcode Files/Login FireBase/Login FireBase/Login FireBase/Info.plist'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? what does it means I have already gone through several forms before posting it can anyone say what should I do
1
0
7.5k
Oct ’22
Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value .... what im I doing wrong
//  OTPViewController.swift //  FinalBookingApp // //  Created by Makwin Santhosh K on 19/10/22. // import UIKit import FirebaseAuth import Firebase import FirebaseCore class OTPViewController: UIViewController {          @IBOutlet weak var OTPLabel: UILabel!          @IBOutlet weak var EnterOTPLabel: UILabel!     @IBOutlet weak var MailTextField : UITextField!     @IBOutlet weak var PasswordTextField: UITextField!     @IBOutlet weak var EnterOTPTextField: UITextField!     @IBOutlet weak var VerifyButton: UIButton!     @IBOutlet weak var ErrorLabel : UILabel!               override func viewDidLoad() {         super.viewDidLoad()                  // Do any additional setup after loading the view.     }     // check the data validate Things     func validateFields() -> String?{         if PasswordTextField.text?.trimmingCharacters(in: .whitespacesAndNewlines) == "" //   // im getting error in this error saying "Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value"         {             return "Please enter the password without the BlankSpaces"         }         let cleanedPassword = PasswordTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)         if Helpers.isPasswordValid(cleanedPassword) == false{             //Password wasn't secure enough             return "Please make sure your password is at least 8 characters, contains a special character and a number."         }         return nil     }          /*      // MARK: - Navigation            // In a storyboard-based application, you will often want to do a little preparation before navigation      override func prepare(for segue: UIStoryboardSegue, sender: Any?) {      // Get the new view controller using segue.destination.      // Pass the selected object to the new view controller.      }      */          @IBAction func ButtonTapped(_ sender: Any) {         let error = validateFields()                  if error != nil {                          // There's something wrong with the fields, show error message             showError(error!)         }         else {             let Email = MailTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)             let Password = PasswordTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)             //MARK: Create a User             Auth.auth().createUser(withEmail: Email, password: Password){(result,err) in                 if err != nil {                                          // There was an error creating the user                     self.showError("Error creating user")                 }                 else {                                          let db = Firestore.firestore()                                                               db.collection("Users").addDocument(data: ["mail" : Email, "uid" : result!.user.uid])                 }             }             self.TransistiontoHome()         }              }                  func showError(_ message : String){             ErrorLabel.text = message             ErrorLabel.alpha = 1         }         func TransistiontoHome() {                      }          }
2
0
1.3k
Nov ’22
Publishing changes from within view updates is not allowed, this will cause undefined behavior.
Im building the small Map View by accessing the Users Location From the App Im getting this Error in Xcode 14 in Purple Color there is no error in this Code side it shows only while running in this simulator also according to the error My Location is not updating to it Can any 1 say where am I going wrong below is my code //  MapUIView.swift //  Login_Via_SwiftUI // //  Created by Makwin Santhosh K on 10/11/22. // import SwiftUI import MapKit import CoreLocationUI struct MapUIView: View {     @StateObject private var ViewModel = ContentViewModal()     var body: some View {         ZStack(alignment: .bottom) {             Map(coordinateRegion: $ViewModel.region, showsUserLocation: true)                 .ignoresSafeArea()                                       LocationButton(.currentLocation){                 ViewModel.requestUserLocationForOnce()             }             .foregroundColor(.white)             .cornerRadius(8)             .padding()                      }     } } struct MapUIView_Previews: PreviewProvider {     static var previews: some View {         MapUIView()                  } } final class ContentViewModal: NSObject, ObservableObject, CLLocationManagerDelegate{          @Published var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 40, longitude: 120), span: MKCoordinateSpan(latitudeDelta: 100, longitudeDelta: 100))          let locationManager = CLLocationManager()          override init() {         super.init()         locationManager.delegate = self     }               func requestUserLocationForOnce() {         locationManager.requestLocation()     }          func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {         guard let latestLocation = locations.first else{             //show error             return         }         DispatchQueue.main.async {             self.region = MKCoordinateRegion(center: latestLocation.coordinate, span: MKCoordinateSpan(latitudeDelta: 0.05, longitudeDelta: 0.05))         }     }     func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {         print(error.localizedDescription)     } }
4
0
3.2k
Nov ’22
Button to navigate through SwiftUI Views
this is my code I need my toolBar buttons to navigate to other SwiftUi views what should I write in button action { } to open the other SwiftUi View //  SwiftLoginView.swift //  Login FireBase // //  Created by Makwin Santhosh K on 08/11/22. // import SwiftUI import MapKit import CoreLocationUI struct OverallView: View {     var body: some View{                  NavigationView {             ZStack{                                  ToolBarShape()                     .frame(width: 400,height: 110)                     .foregroundColor(.white)                     .shadow(radius: 6)                     .offset(x : 0, y: 410)                                                     .toolbar {                         ToolbarItemGroup(placement: .bottomBar){                             //MARK: Button Home                             Button(action :{                                                              }, label:{                                 VStack {                                     Image(systemName: "house")                                     Text("Home")                                 }                                 .font(.footnote)                                 .foregroundColor(.black)                                                              })                             Spacer()                             //MARK: Button Money                             Button(action :{                                                            },label:{                                 VStack {                                     Image(systemName: "dollarsign")                                     Text("Money")                                 }                                 .font(.footnote)                                 .foregroundColor(.black)                                                              })                             Spacer()                             //MARK: Button Home                             Button(action :{                                                              },label:{                                 VStack {                                     Image(systemName: "person")                                     Text("Help")                                 }                                 .font(.footnote)                                 .foregroundColor(.black)                                                                                               })                             //MARK: Button Home                             Spacer()                             Button(action :{                                                              },label:{                                 VStack {                                     Image(systemName: "menubar.rectangle")                                     Text("More")                                 }                                 .font(.footnote)                                 .foregroundColor(.black)                                                                                               })                                                                                   }                                              }             }         }     } }      struct MapUView: View {     @StateObject public var ViewModel = ContentViewModal()          var body: some View {         ZStack(alignment: .bottom) {             AreaMap(region: $ViewModel.region)                          LocationButton(.currentLocation){                 ViewModel.requestUserLocationForOnce()             }             .foregroundColor(.white)             .cornerRadius(8)              }     }                                   struct AreaMap: View {         @Binding var region: MKCoordinateRegion                  var body: some View {             let binding = Binding(                 get: { self.region },                 set: { newValue in                     DispatchQueue.main.async {                         self.region = newValue                     }                 }             )             return Map(coordinateRegion: binding, showsUserLocation: true)                 .ignoresSafeArea()         }     }               final class ContenViewModal: NSObject, ObservableObject, CLLocationManagerDelegate{         @Published var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 20, longitude: 90), span: MKCoordinateSpan(latitudeDelta: 100, longitudeDelta: 100))         let locationManager = CLLocationManager()                  override init() {             super.init()             locationManager.delegate = self         }                  func requestUserLocationForOnce() {             locationManager.requestLocation()         }                  func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {             guard let latestLocation = locations.first else {                 //show error                 return             }             self.region = MKCoordinateRegion(center: latestLocation.coordinate, span: MKCoordinateSpan(latitudeDelta: 0.05, longitudeDelta: 0.05))         }                  func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {             print(error.localizedDescription)         }     } } struct OverallView_Previews: PreviewProvider {     static var previews: some View {         OverallView()     } }
5
0
5.1k
Nov ’22
cannot find 'minutes' in the scope
im getting this error after this code, what module should Iimport here? or does it causes any other problem? //  ContentView.swift //  Widget_and_LiveActivities // //  Created by Makwin Santhosh K on 20/11/22. // import SwiftUI import ClockKit struct ContentView: View {     var body: some View {         var future = Calendar.current.date(byAdding: .minute, value: (Int(minutes) ?? 0), to: Date())! // here is where im getting (cannot find 'minutes' in the scope)         future = Calendar.current.date(byAdding: .second, value: (Int(seconds) ?? 0), to: future)! // also where is where im getting (cannot find 'seconds' in the scope)         let date = Date.now...future         let updatedDeliveryStatus = PizzaDeliveryAttributes.PizzaDeliveryStatus(driverName: "Anne Johnson", deliveryTimer: date)         let alertConfiguration = AlertConfiguration(title: "Delivery Update", body: "Your pizza order will arrive in 25 minutes.", sound: .default)         await deliveryActivity?.update(using: updatedDeliveryStatus, alertConfiguration: alertConfiguration)                           let initialContentState = PizzaDeliveryAttributes.ContentState(driverName: "Bill James", deliveryTimer:date)         let activityAttributes = PizzaDeliveryAttributes(numberOfPizzas: 3, totalAmount: "$42.00", orderNumber: "12345")         do {             deliveryActivity = try Activity.request(attributes: activityAttributes, contentState: initialContentState)             print("Requested a pizza delivery Live Activity \(String(describing: deliveryActivity?.id)).")         } catch (let error) {             print("Error requesting pizza delivery Live Activity \(error.localizedDescription).")         }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()     } } // this is the example code from [https://developer.apple.com/documentation/activitykit/displaying-live-data-with-live-activities)
7
0
2.3k
Nov ’22
Cannot convert value of type 'Set<HKQuantityType>' to expected argument type 'HKQuantityType
below is my code of reading data from HealthKit for Multiple Data but for reading Multiple data using Set() it shows "Cannot convert value of type 'Set' to expected argument type 'HKQuantityType' " func readData(completion: @escaping (HKStatisticsCollection?)-> Void){         let stepCount = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.stepCount)!         let MoveCount = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.appleMoveTime)!         let DistanceCount = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.distanceWalkingRunning)!         let Activitysummary = Set([stepCount,MoveCount,DistanceCount])                  let startDate = Calendar.current.date(byAdding: .day, value: -7, to: Date())         //MARK: here we setting our start time at 12.00 AM         let anchorDate = Date.monday12AM()         //MARK: we going to calculate the value for each day         let daily = DateComponents(day : 1)         let predicate = HKQuery.predicateForSamples(withStart: startDate, end: Date(), options: .strictStartDate)         //MARK: .cummulativesum -> iPhone and Apple Watch Difference         query =  HKStatisticsCollectionQuery(quantityType: Activitysummary, quantitySamplePredicate: predicate,options: .cumulativeSum, anchorDate: anchorDate, intervalComponents: daily) //MARK: here in ActivitySummary it show the error                  query!.initialResultsHandler = { query,statisticsCollection, error in             completion(statisticsCollection)         }         if let healthStore = healthStore, let query = self.query{             healthStore.execute(query)         }     }
3
0
2.6k
Jan ’23
I need to read multiple Queries of HKStatisticsCollectionQuery Like StepCount and Swimming Stroke
This is the the func for Authorisation from health App func stepCount(completion: @escaping (Bool) -> Void){ if HKHealthStore.isHealthDataAvailable(){ let stepCount = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.stepCount)!  let swimmingStrokeCount = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.swimmingStrokeCount)!   guard let healthStore = self.healthStore else { return completion(false) }   healthStore.requestAuthorization(toShare: [], read: [swimmingStrokeCount,stepCount]) { (success, error) in completion(success)             }   }     } and then Im not able to read both step count and swimming Stroke at the the same query func readData(completion: @escaping (HKStatisticsCollection?)-> Void){         let stepCount = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.stepCount)!         let swimmmingStrokeCount = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.swimmingStrokeCount)!         let startDate = Calendar.current.date(byAdding: .day,value: -7, to: Date())         let anchorDate = Date.monday12AM()         let daily = DateComponents(day : 1)         let predicate = HKQuery.predicateForSamples(withStart: startDate, end: Date(), options: .strictStartDate)         query = HKStatisticsCollectionQuery(quantityType: stepCount, quantitySamplePredicate: predicate,options: .cumulativeSum, anchorDate: anchorDate, intervalComponents: daily)         query1 = HKStatisticsCollectionQuery(quantityType: swimmmingStrokeCount, quantitySamplePredicate: predicate,options: .cumulativeSum, anchorDate: anchorDate, intervalComponents: daily)         query!.initialResultsHandler = { query, statisticsCollection, error in             completion(statisticsCollection)         } if let healthStore = healthStore, let query = self.query {             healthStore.execute(query)         }     } is there any possible way to call both query and query1 as a single query also I have tried to call them entirely separate as two different queries but that too is not working as expected it results becomes sum of step count and swimming stroke can anyone clear my doubt?
1
0
1k
Mar ’23