Questions tagged [combine]

Combine is Apple's declarative Swift API for processing values over time. It is based on the Reactive Streams semantics. Use this tag for questions about the Combine framework.

Combine is a closed-source Apple framework based on semantics defined by the Reactive Streams initiative.

Combine defines a declarative API in the Swift programming language for processing values over time. Unlike other Swift reactive frameworks such as RxSwift and ReactiveSwift, Combine includes support for back-pressure and flow control at a fundamental level.

Apple first revealed Combine at WWDC on June 3, 2019 and made it available in the first beta release of Xcode 11.

Combine is part of the following SDKs:

  • macOS 10.15 (Catalina) and later,
  • iOS 13 and later,
  • tvOS 13 and later,
  • watchOS 6 and later.
1968 questions
0
votes
2 answers

How to decode error response message in Combine?

I'm doing login using SwiftUI and Combine. Could you please give me some idea how can I decode and show json error when user types incorrect email or password? I can only get token. When I'm doing the same login request with incorrect email or…
Abrcd18
  • 155
  • 1
  • 13
0
votes
1 answer

SwiftUI/Combine notification overwrites my struct with incorrect values

I've posted a minimal example to github. This question seems like it might be related, but I couldn't make any progress. I have an @ObservableObject class that contains a @Published struct. I have a Slider bound to a field in that struct, and two…
SaganRitual
  • 3,143
  • 2
  • 24
  • 40
0
votes
1 answer

How to use StateObject and Combine with JSON loader?

I'm currently trying to load JSON in Swift to use it in my UI. I think I've managed to get the JSON to load properly, but I can't test it due to the multiple errors I'm getting in my code. JSONReader.swift: import Foundation struct DatabaseObject:…
macOS_Master
  • 27
  • 1
  • 5
0
votes
1 answer

Is there any method to control the frequency of the realm publisher?

My View show some data subscribed to a realm publisher. So if I insert some new objects to the realm db, the realm publisher will send a new data list to the subscriber and the view will be refreshed. The problem is that when I insert N data into…
0
votes
1 answer

Making custom Deffered Future Publisher in Swift Combine?

Like the title says I would like to make custom publisher that will basically function like deffered future. Normally when I want to encapsulate code in some Future, but want it to execute on subscription, I would need to write something like…
MegaManX
  • 8,766
  • 12
  • 51
  • 83
0
votes
1 answer

Swift crashes when update published value inside a thread synchronously on iOS 13

I have several steps need to be processed synchronously. And the value resulted from the process are consumed by the view. It's working on iOS 14, but it's crashing on iOS 13. I use a Combine to publish an event to update the value stored inside the…
mrjimoy_05
  • 3,452
  • 9
  • 58
  • 95
0
votes
1 answer

How to refactor converting Generic typed results to Solid struct in Combine

I have this ugly construction of returning generic type as solid model, does anyone have ideas on refactoring to be more declarative? extension NetworkingService { func login(email: String, password: String) -> AnyPublisher
0
votes
1 answer

View not reacting to changes of Published property when its chained from another ObservedObject

Below is the SwiftUI view which owns a ViewModel and the logic is if the viewModel.authenticationService.user contains a user object then it will show the HomeView, else case will be asked for Login. So initially the…
Parth Adroja
  • 13,198
  • 5
  • 37
  • 71
0
votes
0 answers

Combine frame: Generic Parsing No value associated with key CodingKeys using

I am trying to parse below josn, but not able to parse (using Combine for service API). { "data": { "user_data": { "u_id": 14252, "first_name": "Amar", "last_name": "", "email": "sample@gmail.com", "birth_date":…
0
votes
0 answers

SwiftUI not update view using @Published

I can't update the color of my Text base on the current status of my object. The text should change color base on the variable status true or false. I try below to simplify the code of where the data come from. My contentview: struct ContentView:…
Damiano Miazzi
  • 1,514
  • 1
  • 16
  • 38
0
votes
1 answer

Combine two dataframes

I have two dataframes: df1 has columns - id, Text, imageid, label df2 has columns - imageid, imageurl I want to combine both the dataframes such that the imageurl should be linked to their corresponding imageid in df1. Can someone guide me how to do…
0
votes
1 answer

Generic Func: Key path value type '[T]' cannot be converted

I'm playing with Combine to learn it and improve my reactive programming skills, and I'm trying to create some generic class that convert data to my T type I have this error, and I don't understand why Key path value type '[T]' cannot be converted…
swifthing
  • 440
  • 4
  • 11
0
votes
1 answer

How do I fix the error described during json parsing using combine?

I'm trying to parse stock data from the website alphavantage.com using the combine frame work. I keep getting this error Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue:…
0
votes
1 answer

in Swift Combine how to use combine latest or catch to check error?

I have a flow where I should get posts from web, and save them on user defaults as test, if there is some issue, load the list from users default instead from web. now I have two emitters, I think I should perform a check in my repository, something…
biggreentree
  • 1,633
  • 3
  • 20
  • 35
0
votes
1 answer

SwiftUI: Unexpectedly found nil while unwrapping an Optional value

I am following Stanford's CS193p Developing Apps for iOS online course. I'm trying to do the Assignment 6 (Memorize Themes.pdf). When I run my app in simulator and in edit mode tap on a list row to bring up the sheet, I get the following fatal…
user14119170
  • 1,191
  • 3
  • 8
  • 21