Questions tagged combine

Explore the latest questions and answers asked by our top developers.

Unexpected Combine Publisher Behavior

I’m building a mortgage calculator as an exercise to learn Combine. Everything has been going swimmingly until I encountered a situation where I’m not getting deterministic published output from one of my Publishers when I unit test it. I’m not making any asynchronous calls. This is the problematic AnyPublisher: public lazy var monthlyPayment: AnyPublisher<Double, Never> […]

By Adrian
Published
Categorised as combine, publisher, swift Tagged , ,

SwiftUI – Get User’s coordinates to pass in API call

This problem has been haunting me for months and I believe it comes down to my using the wrong structure and procedure. I’m trying to do an API call to Yelp’s API and passing in the variables for the user’s lat/long. I’m able to grab the lat/long based on my current LocationManager, however when it […]

How do you share a data model between a UIKit view controller and a SwiftUI view that it presents?

My data model property is declared in my table view controller, and the SwiftUI view is modally presented. I’d like the presented Form input to mutate the data model. The resources I’ve found on data flow are just between SwiftUI views, and the resources I’ve found on UIKit integration are on embedding UIKit in SwiftUI […]

By Austin Conlon
Published
Categorised as combine, swift, swiftui, uikit Tagged , , ,

persistent value in a picker changing views in Swift

I don’t understand how implementing in Swift a simple picker showing a list of values that retain the selected value switching between different views. I’m able to use the selected value to update the Model via Combine framework by the way. here’s the code, but the onAppear{}/onDisappear{} doesn’t work as expected: struct CompanyView: View { […]

By Manuel Zompetta
Published
Categorised as combine, forms, picker, swift

persistent value in a picker changing views in SwiftUI

I don’t understand how implementing in SwiftUI a simple picker showing a list of values that retain the selected value switching between different views. I’m able to use the selected value to update the Model via Combine framework by the way. here’s the code, but the onAppear{}/onDisappear{} doesn’t work as expected: struct CompanyView: View { […]

By Manuel Zompetta
Published
Categorised as combine, forms, picker, swift

Combine framework: how to process each element of array asynchronously before proceeding

I’m having a bit of a mental block using the iOS Combine framework. I’m converting some code from “manual” fetching from a remote API to using Combine. Basically, the API is SQL and REST (in actual fact it’s Salesforce, but that’s irrelevant to the question). What the code used to do is call a REST […]

By matt
Published
Categorised as combine, ios, swift

swift combine sink receiveValue memory leak

I’m having a hard time with dealing with Combine. After the publisher is complete I want to update a value but whenever I update that value the memory is allocated and never goes away. Whenever I try to assign image there is a leak. If I don’t assign no leak. This is what my code […]

By Peter Warbo
Published
Categorised as combine, memory-leaks, swift

Why does Text disappear when i click submit?

When I type in my EditText view to fill out all the required information and then click submit. Everything I typed disappears. I want this text to remain. I am guessing there is something wrong with my @State objects but cannot figure out what. SignUpViewModel class SignUpViewModel : ObservableObject { @Published var error: String? = […]

By Adrian Le Roy Devezin
Published
Categorised as combine, ios, swift, swiftui

Swift Combine Subscriptions, right flow and architectural choices

Let’s say that: • My application is a client of a Socket server. • I’m free to write the Socket client implementation to fit with Combine as I prefer I’ve implemented 2 solutions, one with CurrentValueSubject (quite easy) and a second with a custom subscription and a custom publisher that I’m not sure about. I […]

By MatterGoal
Published
Categorised as combine, swift

Combine: Going from Notification Center addObserver with selector to Notification publisher

I’ve seen how to transition to Combine using a Publisher from some NotificationCenter code, but have not seen how to do it for something like: NotificationCenter.default.addObserver( self, selector: #selector(notCombine), name: NSNotification.Name(rawValue: “notCombine”), object: nil ) I’ve seen that this is available as a Publisher, but I don’t have a selector and am not sure what […]

By SRMR
Published
Categorised as combine, swift
1 2

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq