Category "swift"

Trying to decode dynamic JSON response

I'm trying to decode the JSON response for all tags from the Pinboard API. I have a simple model I'd like to decode into: struct Tag: Coddle, Hashable {

How to decode JSON array as property of struct with JSONDecoder

I had data struct like this { "version": 1, "profile": [ { "type": "name", "value": "Hellow" }, {

Property initializers run before 'self' is available

Seems like I'm having a problem with something that shouldn't be the case... But I would like to ask for some help. There are some explanations here on the Stac

How to decode JSON array as property of struct with JSONDecoder

I had data struct like this { "version": 1, "profile": [ { "type": "name", "value": "Hellow" }, {

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