Category "swift"

UITableViewCell does not show cell until I navigate to parent view controller and come back

My tableview does not show cell data until I tap on back button and return to table view controller. My app is loading data from Firebase. class ViewPostsViewCo

Getting the out of range index error when trying to make a Page Tab View from API array

This is my Model: class Api { func getRockets(completion: @escaping ([Rocket]) -> ()) { guard let url = URL(string: "https://api.spacexdata.com/v

How Do I relogin after getting a 401 back using URLSession and CombineAPI

I'm new to combine and URLSession and I'm trying to find a way to log in after I get a 401 error back. My Set up for the URLSession. APIErrors: enum APIError:

Segue Identifier is going missing in Swift 5.6

I've only been programming for a month, and I am trying to cobble together a mockup and I keep getting the following error: Terminating app due to uncaught exc

SwiftUI @AppStroage - 'Simultaneous accesses to *, but modification requires exclusive access'

In my project I was dealing with this issue. After many hours, I was able to track down the causes and reduce them into a small demo, but do not understand the

How to animate a view transition on a conditional view?

The setup is quite simple: State/Observable/Computet property, let's call it S1 Views (V1, V2) that depend on S1 The following conditions must hold: V1 should h

How can I use the AVAudioSEssion in a swift package when the package could be used by Macos?

import Foundation import AVFoundation @available(iOS 14, *) extension AVAudioSession { class func set(category: AVAudioSession.Category = .playback) {

Swift - How to have multiple decoder method for a single model

struct Classroom: Codable { let teacher: String let id: Int let status: Bool init(from decoder: Decoder) throws { ... ... } }

What are the best practices to display hardcoded pre-made long texts in an xcode project?

This will soon be my first time publishing an iOS app, and I just finished writing my privacy policy and terms & conditions texts. Best idea I came up with

How to properly add time to Firestore & compare it to a future timestamp to determine a subscription expiry date swift

What is the proper way to save time to Firestore & how do I get back the values to compare them & determine if a subscription is expired? I am currently

Moving Table rows in SwiftUI

Is it possible to support moving rows in a SwiftUI Table view? I know there's List which can optionally support selection and drag-and-drop to move single or mu

Swinject always return nil when trying to resolve any object

I have the following Swinject implementation in my app - import Foundation import Swinject @propertyWrapper struct Inject<Component> { let wrappedVal

SwiftUI can't redirect on receiving push notifications

I'm developing in SwiftUI and I want to get a message when I get a push notification so I can navigate to a specific part of the app. After googling I can't ge

MacOS: reading shared preferences in Swift and ObjectiveC

I have a project that mixes Swift and objective c. The controller for my preference panes is written in Swift. I can’t seem to read those preferences in O

How to get CLPlacemark from Location in SwiftLocation 5.1.0?

This is a library that doesn't have a very great documentation, In the past, I had problems migrating from a previous version to a modern version, and now, I ha

How can make a record when call coming and calling to other side in swift

When I make project with AVFoundation library it is possible to make recording my voice. But when call comes and when I call the somebody record being disabled

Gap glitch between navigation bar and table view only on iPad

This issue does not exist when my app is run on the iPhone, and it also doesn't exist in the simulator, but whenever I run the app on my physical iPad this weir

swift how to update viewModel parameter while init

I have encountered the problem "Cannot assign to property: 'self' is an immutable capture". How can i call API to check status and update "getUpdateSuccess" pa

Unable to select files form UIDocumentPickerViewController Swift

I am working on UIDocumentPickerViewController() in swift. After opening the document picker the files and images look blur and I can't able to select anyone of

How do I Set Unselected Tab Bar Item Color using Swift in Xcode with an iOS 15+ Device?

I'm trying to customize a UITabBar using Swift in Xcode, however I can't figure our how to set the color of the unselected items using the menu on the right sid