Tyrique  Littel

Tyrique Littel


Combining Network Requests with Combine and Swift

In this tutorial, you learn how to combine and chain publishers in Combine with Publishers.Zip and flatMap().

What if a HTTP network request depends on the response of another? In this tutorial, we’ll discuss how you can parallelize and/or serialize networking tasks with Combine.

Here’s what we’ll get into:

  • Combining multiple Combine publishers in Swift
  • Working with Publishers``.``Zip and flatMap()
  • How subscribers and publishers work in Combine
  • Getting to know Combine’s generics and types
  • Working with JSON and Codable with Combine
  • Making network requests with Combine and URLSession
  • Getting to know various Combine operators, like map``()
  • Practical use cases for combining and chaining publishers

Ready? Let’s go.

  1. Why Combine Multiple HTTP Requests?
  2. Working with Combine in Swift
  3. Combining Publishers with Publishers.Zip
  4. Chaining Publishers with flatMap()
  5. Wrapping Up
  6. Further Reading

#swift #mobile-apps #programming #developer

What is GEEK

Buddha Community

Combining Network Requests with Combine and Swift
Houston  Sipes

Houston Sipes


10 Free Online Resources To Learn Swift Language

Swift is a fast and efficient general-purpose programming language that provides real-time feedback and can be seamlessly incorporated into existing Objective-C code. This is why developers are able to write safer, more reliable code while saving time. It aims to be the best language that can be used for various purposes ranging from systems programming to mobile as well as desktop apps and scaling up to cloud services.

Below here, we list down the 10 best online resources to learn Swift language.

(The list is in no particular order)

#developers corner #free online resources to learn swift language #learn swift #learn swift free #learn swift online free #resources to learn swift #swift language #swift programming

Top Swift Development Companies | Top Swift Developers - TopDevelopers.co

A thoroughly researched list of top Swift developers with ratings & reviews to help find the best Swift development companies around the world.

#swift development service providers #best swift development companies #top swift development companies #swift development solutions #top swift developers #swift

Hire Dedicated Swift Developers

Want to create a native iOS application for your Startup?

Hire Dedicated Swift Developers for end-to-end services like development, migration, upgrade, testing, and support & maintenance. Trust HourlyDeveloper.io our Swift development team for iOS device apps that are high on performance and security.

Consult with experts:- https://bit.ly/2C5M6cz

#hire dedicated swift developers #swift developers #swift development company #swift development services #swift development #swift

Osborne  Durgan

Osborne Durgan


Combining Parallel Network Requests with RxSwift


Concurrency is a concept that every mobile developer should know. It is the notion of multiple things happening at the same time.

The key is to divide our program into small tasks that can run in parallel, and the final result shouldn’t be affected by the order of the task completion, meaning if task A finishes before task B, the outcome should be the same as if task B finishes before task A.

In the iOS ecosystem, there are several tools to achieve that:

  • NSOperation
  • NSThread
  • Grand Central Dispatcher
  • Reactive Programming frameworks like RxSwift, ReactiveSwift, Combine, etc

When dealing with network requests, the recommended approach is to have an asynchronous task (the thread initiated the task won’t wait until the task is completed to continue executing other tasks) in a background thread (because the main thread should be free for UI updates only). This will guarantee a smooth, freeze-free user experience, that allows the user to continue using the app while the network request eventually finishes some time in the future.

Parallel execution improves the overall speed of the app, if task A takes 2 seconds and task B takes 3 seconds, the 2 tasks running in parallel would take 3 seconds, whereas running in serial (one after the other) would take 5 seconds.

Real-world use case

In the classifieds company I worked, there was a screen on the app to display the search results using a UITableView, and the Business wanted to display Featured (premium/paid) results on top of the regular/free results, a practice widely used in the e-commerce and classified world.

The backend had 2 different endpoints to be consumed, one for regular results, one for premium results, and both require the same parameters. The discussion of whether or not the endpoints should be merged into one is for another post.

#rxswift #ios #networking #ios-app-development #swift #neural networks

Best Swift App Development Company

Hire an Exceptional Swift App Developer from Mobile App Development India. Maadi has a dedicated Swift App Development team that is superiorly talented and builds highly functional, cost-effective mobile apps with error-free coding.

Contact: https://www.mobile-app-development-india.com/swift-app-development/

#swift ios app development india #hire swift programmer india #swift ios development #apple swift app development #swift mobile app development #swift app development