Post

Replies

Boosts

Views

Activity

How to Compare Two Paths
Hello, I was wondering how to compare two UIPaths together. Perhaps also find a percentage difference between the two. I was thinking initially of comparing the coordinates of every point. Are there any better solutions? Thank you.
0
0
148
Jan ’24
Changing Cell's Background Color
I am trying to change the cell's background color depending on their placement, i would like to create an effect like this This is the code i use func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { if totalCells % 2 == 0 { cell.backgroundColor = UIColor(red: 200/255.0, green: 200/255.0, blue: 200/255.0, alpha: 1.0) } else { cell.backgroundColor = UIColor.white } } The problem is that the cells are in a scrolling tableview, and that when I scroll, the cells get reused for memory purposes, and the colors start changing incorrectly, like the same colors are ending up next to each other, which is not supposed to happen. I am updating the totalCells Variable whenever I add a cell (inside the cellForRowAt function) How could I fix this? Thank you!
1
0
200
Aug ’23
How to go back to a view controller that wasn't presented without memory leak
I'm trying to back to my initial view controller, but it wasn't presented if the user was already logged in. So, when the user logs out, i want to go back to the initial view controller. i'm currently using a segue, but that would cause a memory leak if used too much. I can't user an unwind segue since the initial view controller was never presented. How would i do this? Thanks.
1
0
368
Apr ’23
Navigation Bar disappearing when using RootViewController
I am trying to see if the user is logged in using the userdefaults, and if he is, to display the main view controller. This is the scene delegate code. var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { if UserDefaults.standard.bool(forKey: "isLoggedIn") && false { let homeViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MainStoryBoard") as! MainViewController let navigationController = UINavigationController(rootViewController: homeViewController) window?.rootViewController = navigationController } else { let homeViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "InitialViewController") as! InitialViewController let navigationController = UINavigationController(rootViewController: homeViewController) window?.rootViewController = navigationController } window?.makeKeyAndVisible() } This is what it's supposed to look like: However, this is what it looks like : We can see the navigation bar is totally gone. This is how my views look like. I have a tab view controller linked to a navigation view controller linked to the main view controller I would like to present. Thanks!
2
2
628
Apr ’23
Navigation Bar dissapearing when using rootViewController
I am trying to see if the user is already logged in, and if he is, to bring him to a navigation controller, which contains the mainViewController. This is in my scene delegate if UserDefaults.standard.bool(forKey: "isLoggedIn") { let homeViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MainStoryBoard") as! MainViewController let navigationController = UINavigationController(rootViewController: homeViewController) window.rootViewController = navigationController } This is what it's supposed to look like But, instead, it removes the navigation bar.
0
1
357
Apr ’23
Firebase Storage not uploading/downloading correctly
I am trying to publish and download images from firebase storage. I publish an Image, and then try to fetch it, which works, but when I try to replace that same image by another one, and then fetch that new image, it still shows me the old image, even though when I look in the database, it shows the new Image and nothing else. There are no errors. This is how I am fetching my image. let storageRef = Storage.storage().reference() let ref = storageRef.child("Profiles/\(UserModel.docId).jpeg")          let placeHolderImage = UIImage(systemName: "person.circle.fill")    profileImage.sd_setImage(with: ref, placeholderImage: placeHolderImage) This is how I am uploading my images let storageRef = Storage.storage().reference() let ref = storageRef.child("Profiles/\(UserModel.docId).jpeg")       let metaData = StorageMetadata() metaData.contentType = "image/jpeg" ref.putData(ImageData, metadata: metaData)
1
0
573
Mar ’23
MapKit not showing right location when I updated to new ios 16.3.1
I have a mapkit that shows the user's location on the map. This was working, until I updated my iphone 14 to ios 16.3.1, Now it shows the user's location on New York(because the default location I set is NY) I also have an autocomplete, but since that it thinks my location is in new york, it shows me places that are in new york. This is my viewdidLoad locationManager.delegate = self       locationManager.requestWhenInUseAuthorization() locationManager.requestLocation() locationManager.startUpdatingLocation()       mapView.showsUserLocation = true       let locationSearchTable = storyboard!.instantiateViewController(withIdentifier: "LocationSearchTable") as! LocationSearchTable resultSearchController = UISearchController(searchResultsController: locationSearchTable) resultSearchController?.searchResultsUpdater = locationSearchTable       let searchBar = resultSearchController!.searchBar searchBar.sizeToFit() searchBar.placeholder = "Search for restaurants" navigationItem.titleView = resultSearchController?.searchBar       resultSearchController?.hidesNavigationBarDuringPresentation = false definesPresentationContext = true       locationSearchTable.mapView = mapView       locationSearchTable.handleMapSearchDelegate = self
1
1
548
Feb ’23
Framework not found GooglePlaces
Hello, I am trying to use the framework googleplaces for my app. However, it keeps throwing this error. Three days ago, this worked, however, I accidentally switched to an old git version without GooglePlaces, and now, it doesn't work anymore. This is my podfile : source 'https://github.com/CocoaPods/Specs.git' platform :ios, '14.0' target 'FirstApp' do  use_frameworks!  pod 'GooglePlaces', '7.3.0'  pod 'FirebaseAuth'  pod 'FirebaseFirestore' end When i remove the googleplaces pod, it works. I tried everything I could find on stackOverflow, like : 1- Uninstalling and clearing cache 2- Making new projects just to test this 3- changing the framework search paths 4- I am opening the .xcworkspace 5- deleting all pods and reinstalling
2
1
972
Jan ’23