https://github.com/jamesrochabrun/iOSConcurrency

Today I want to show how I used the new group tasks iOS 15 API in a sample project, to execute a group of networking calls to the Itunes API.

The project is pretty simple and looks like this…


https://developer.apple.com/videos/play/wwdc2021/10132/

Completion handlers are closures, self-contained blocks of functionality that can be passed around and used in your code. They get passed to a function as an argument and then called when that function is done.

They are used in iOS when we want to execute an asynchronous job, for example, let’s see how a generic API that uses a URLSessionDataTask to perform a request and decodes the response looks like. It will look something like this…

Generic networking layer — completion handlers

Here the public fetch function calls the private decoding task function internally. The decoding task function uses a…


Photo by Mika Baumeister on Unsplash

In this post, I want to share with you an example of how to mix UIKit and SwiftUI in your projects. For that, I created a small library called CompositionalList. 🧩

CompositionalList is a SwiftUI UIViewControllerRepresentablewrapper powered by UIKit DiffableDataSourceand Compositional Layout. 🥸
It is customizable and flexible, supports multiple sections, cell selection, and can be used in UIKit using a UIHostingController or in a SwiftUI app.

You can add it to your project directly adding it as a swift package in Xcode: Click File -> Swift Packages -> Add Package Dependency and add this URL.

For this example, we…


In this short post, I will show you how to create a generic Networking API that you can reuse in your own implementations using generics and Combine. We won’t go in-depth of explaining elements of the Combine framework, instead, I will show you an example on how to use generics to boost your code reusability.

You will see here:

  1. Mix of generics and Combine Framework to create a reusable networking layer.
  2. Display elements from a network response in a SwiftUI list.

Don’t want to keep reading give me the code!. 😡

Let’s divide this into 3 simple steps…

Step 1…


https://developer.apple.com/design/human-interface-guidelines/ios/bars/sidebars/

Side bars are how we should create a hierarchical navigation system in iPad for non compact mode environments in iOS 14.

Ok , but what is actually a side bar? is just a view controller that has a collection view that uses the new side bar appearance list layout.

(Don’t want to read your stuff 😡, give me the code)

Since iOS 14 Apple introduced UICollectionLayoutListConfiguration an incredible improvement for UICollectionViews that allows us use a set of defined configurations for our collection views.

From the docs.

You create a sidebar by using a sidebar-style list and placing it in…


Instagram iPad Prototype

In this post, we are going to talk about building for the iPad. We are going to use a prototype for Instagram to highlight key topics in how the OS manages its layout system to adapt to different iPad devices and to multitasking environments. Not sure why Instagram is not supported for iPad yet but I am sure it may not be far to be available. The prototype looks like this…


I don’t know you but this year WWDC left me with mixed feelings, on one hand, it made me feel already outdated and on the other, you know 🤯.

From Swift UI, to new ways of handling layout in collection views and managing Datasource states, the new features that are available for developers are just mind-blowing.

On this post, I will talk about one of the API enhancements that got me excited the most, Diffable DataSource. …


https://swapi.co/

Well, here we go again, one more time I will like to talk about generics and protocols in Swift 4.2.

A few days ago I gave me a small challenge, the goal? implement a client API for SWAPI the “Star Wars API”, made by Paul Hallett, avoiding code repetition as much possible but still keeping things making sense.

On this tutorial we will implement a client API using Swift Meta Types, Protocols with associated types, protocol inheritance, enums with associated values and of course generics, if any of this topics is not familiar to you I suggest stop here and…


https://www.objc.io/books/functional-swift/

If you are an iOS developer you may hear about functional programming in Swift, but what is for real Functional programming? From Wiki

In computer science, functional programming is a programming paradigm — a style of building the structure and elements of computer programs — that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.

It is not easy to give a straightforward explanation about this, however, think about it as instead of building a program in a sequence of assignments and function calls, emphasize it in repeatedly break it in smaller pieces that can…


Its been a while since I wrote “Protocol Based Generic Networking using JSONDecoder and Decodable in Swift 4” on that post I talked about how to use Decodable, protocols and generics to create a reusable networking layer.

It worked great but the API was limited to the GET HTTP method, that's why on this tutorial I want to extend it to use the POST method, I will do my best to show you how to use enums to do the job, I will assume that you didn’t read part 1 so I will start from zero in a new project…

James Rochabrun

Senior iOS Engineer #latinintech

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store