Posts

Post marked as solved
4 Replies
2.5k Views
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)     } }
Posted Last updated
.
Post marked as solved
3 Replies
3.6k Views
I have to added the background image and background colour in launch screen but for user experience i need to add the loading animation in launch screen, I also used the Activity indicator View but it is not moving (not showing animation) is there is any way to add LottieView or Rive Animation in Launch Screen
Posted Last updated
.
Post marked as solved
2 Replies
1.3k Views
this is not an code related doubt I have 2 two storyboard which is connected to each other say like LoginView and SignUpView in storyBoard and then I have create the HomeView in SwiftUI File How do I tell the Xcode to run the SwiftUI File after the LoginView.StoryBoard
Posted Last updated
.
Post marked as solved
2 Replies
965 Views
//  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() {                      }          }
Posted Last updated
.
Post marked as solved
1 Replies
5.3k Views
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
Posted Last updated
.
Post marked as solved
2 Replies
1.3k Views
I have just started to learn Storyboard While I was Creating the View Controller, the Assistant doesn't open up to opens up only for navigation controller. I have like 2 View Controller, Assistant doesn't showing up for those two of them. can anyone point out where it I make a mistake.
Posted Last updated
.
Post not yet marked as solved
1 Replies
3.9k Views
import SwiftUI struct ButtonUI: View {     var body: some View {                      ZStack {                                  Color.white             RoundedRectangle(cornerRadius: 50)                     .fill(.blue)                     .frame(width: 250, height: 75, alignment: .center)                                  Text("Enable Location")                     .font(.title3)                     .fontWeight(.bold)                     .foregroundColor(Color.white)                              }             .offset(x: 0, y: 300)     } } struct ButtonUI_Previews: PreviewProvider {     static var previews: some View {         ButtonUI()     } } // I have used this code to create a button like shape in Xcode how to do i make it work like open the location settings in iPhone // it should work like a button to open the location settings in iPhone
Posted Last updated
.
Post not yet marked as solved
3 Replies
498 Views
import Foundation enum VideoDetails: String, CaseIterable{     case Nature , Food , Animals , Travel } struct ResponseBody: Decodable {     var page: Int     var perPage: Int     var totalResults: Int     var url: String     var videos: [Video]      }      struct Video: Identifiable, Decodable{     var id: Int     var image: String     var duration: Int     var user: User     var videofiles: [VideoFile]                        struct User: Identifiable, Decodable {       var id: Int       var name: String       var url: String    }                 struct VideoFile: Identifiable, Decodable {       var id: Int       var quality: String       var fileType: String       var link: String    }  }   //this one doesn't work but the below code works perfectly can anyone why it is happening import Foundation enum VideoDetails: String, CaseIterable{     case Nature , Food , Animals , Travel } struct Video: Identifiable, Decodable {     var id: Int     var image: String     var duration: Int     var user: User     var videoFiles: [VideoFile]          struct User: Identifiable, Decodable {         var id: Int         var name: String         var url: String     }          struct VideoFile: Identifiable, Decodable {         var id: Int         var quality: String         var fileType: String         var link: String     } }
Posted Last updated
.
Post marked as solved
2 Replies
623 Views
I'm trying to add a video in viewController and there is a minor issue. I'm not able view video them in simulator can any one explain how to view viewController in simulator. when I click the play button it only displays the ContentView
Posted Last updated
.
Post marked as solved
12 Replies
1.4k Views
Button(action:                     CardView() //here it show an error how to add the CardView Swift ui file in this button //                 ) {                         Image(systemName: "creditcard")                         .resizable()                         .foregroundColor(Color("Icon Color"))                         .frame(width:24, height: 24)                                        }                 .padding(.top, 825.0)                 .padding(.trailing, 125.0)
Posted Last updated
.
Post marked as solved
2 Replies
573 Views
import SwiftUI struct List_View: View {     var Wallet : Wallet_Data     var body: some View {                      ZStack {                 ListRectShape()                     .fill(Color.background)                 .frame(width: 368, height: 75)                 Wallet.image                     .padding(.trailing, 280.0)                 Text("Amazon")                     .font(.title3)                     .fontWeight(.light)                     .foregroundColor(Color.white)                     .multilineTextAlignment(.leading)                     .padding(.top, -25.0)                     .padding(.trailing, 125.0)                 Text("Augest 10 2022")                     .font(.body)                     .fontWeight(.light)                     .foregroundColor(Color.white)                     .padding(.trailing, 78.0)                     .padding(.top, 21.0)                 ListRectShape()                     .fill(Color.background)                     .frame(width: 83, height: 33)                     .border(Color.white)                     .padding(.leading, 225.0)                 Text("$109.08")                     .foregroundColor(Color.white)                     .padding(.leading, 225.0)                                                                }                  ZStack {             ListRectShape()                 .fill(Color.background)             .frame(width: 368, height: 75)             Image("Apple WC")                 .padding(.trailing, 280.0)             Text("Apple")                 .font(.title3)                 .fontWeight(.light)                 .foregroundColor(Color.white)                 .multilineTextAlignment(.leading)                 .padding(.top, -22.0)                 .padding(.trailing, 145.0)             Text("Augest 10 2022")                 .font(.body)                 .fontWeight(.light)                 .foregroundColor(Color.white)                 .padding(.trailing, 78.0)                 .padding(.top, 21.0)             ListRectShape()                 .fill(Color.background)                 .frame(width: 83, height: 33)                 .border(Color.white)                 .padding(.leading, 225.0)             Text("$1000.00")                 .foregroundColor(Color.white)                 .padding(.leading, 225.0)                               }                  } } struct List_View_Previews: PreviewProvider {     static var previews: some View {         List_View(Wallet: Wallet_App[0]) // here is were I'm getting an error     } } //this is my ModelData were I'm trying to load my json file import Foundation import Combine final class ModelData : ObservableObject{   var Wallet_App: [Wallet_Data] = load("Contents.json") } func load<T: Decodable>(_ filename: String) -> T {     let data: Data     guard let file = Bundle.main.url(forResource: filename, withExtension: nil)         else {             fatalError("Couldn't find (filename) in main bundle.")     }     do {         data = try Data(contentsOf: file)     } catch {         fatalError("Couldn't load (filename) from main bundle:\n(error)")     }     do {         let decoder = JSONDecoder()         return try decoder.decode(T.self, from: data)     } catch {         fatalError("Couldn't parse (filename) as (T.self):\n(error)")     } }
Posted Last updated
.
Post marked as solved
2 Replies
1k Views
when I'm using for each loop(using repeat command) instead of printing 5 items it is printing 10 times, it always doubles my command it is my code NavigationView {             ScrollView {                 ScrollView(.horizontal , showsIndicators: false){                     HStack(spacing: -10){                         ForEach(0..<5) { item in                             NavigationLink(destination: DetailView()) {                                 CardView()                             CardView()
Posted Last updated
.