Categories
Mastering Development

Function from another class ios swift not executed

Please tell me, I have 2 classes. There is a load_shop() function that enables the display of the webView. If I call a function from the first class ViewController then the function is executed and the webView is displayed, and if from another class CheckUpdate the function is executed (print is output) but the webView […]

Categories
Mastering Development

How can I switch from one tab bar item to another in my Swift project

I have a tab bar controller instance with 5 navigation controllers as its tab bar items. I want to be able to switch from one view controller to another navigation controller programmatically via the tab bar but I am struggling to understand how to do that or even if its possible. Here is what I […]

Categories
Mastering Development

UIImagePickerController must be used from main thread only | app crash

Hi everyone I am implementing UIImagePickerController in iOS 14. When the user selects the camera my app crashes when the user agrees to use the camera, returning this error in purple on xcode – [UIImagePickerController init] must be used from main thread only How can I solve this problem? thanks everyone for the advice private […]

Categories
Mastering Development

displaying calculated float in the UIalertcontroller in swift code

I am using eclipse for swift code to calculate the bmi the answer should be displayed in UIalertcontroller I have done everything til calculating the bmi, and the calculate button works as will. I just need a way to display the variable "bmi" in the UIalertcontroller in the message section, not the title. this code […]

Categories
Mastering Development

AlertView and Present usage swift

I opened a new storyboard with present and also created an alert dialog with loading text. How can I use the two together? There are two present. override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == “loginSuccess” { let vc = self.storyboard?.instantiateViewController(withIdentifier: “TabDeneme”) let alert = UIAlertController(title: nil, message: “Please wait…”, preferredStyle: .alert) […]

Categories
Development

How do I send UIPickerView selected row to another ViewController

I would like to send the selected UIPickerViews row to another view controller. I have placed my UIPickerView didSelectRow inside of my prepare for segue function. However the selected strings are not going to my next View Controller. Could someone explain to me what I am doing wrong? I really appreciate it. import UIKit class […]

Categories
Development

Set Time Default in UIDatePicker

I’m trying to populate a pickerView with a default value (String). Currently I’m able to capture it’s value as a time after the user interacts with it, however I’m not able to set the time value before it becomes visible to the user. I’ve tried let test = dateFormatter.date(from: “09:00 AM”) timePicker.setDate(test, animated: false) however […]

Categories
Database Development

Index related error in retrieving the data from Firestore database

I am not able to load the documents in chat application in Swift IOS using Firestore database, though able to successfully retrieve the data from the Firestore database, I have added the deinit method as well please assist further to resolve the error, I have added the complete view controller , please help me Error […]

Categories
Development

present() method in alert view shows error

I can’t use the method present(). The error is: Value of type ‘ProductByBrandCollectiionView’ has no member ‘present’ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let alert = UIAlertController(title: “Alert”, message: “You select\(NameArray[indexPath.row])”, preferredStyle: .alert) let action = UIAlertAction(title: “Ok”, style: .default, handler: nil) alert.addAction(action) print(“You select \(NameArray[indexPath.row])”) self.present(alert, animated: true, completion: nil) }

Categories
Development

Checking Sign-in Status for Each ViewController

I am a beginner. I am developing an app with swift. I am using Firebase for signin. But I was wondering if I need to write codes to check user’s sign-in status for each viewController for security. Or sign-in is needed only for the sign-in viewController like locking just a front door. My code may […]