Sometimes we need to be UICollectionView’s Cells have size depend on their content and the most common example is the feeds in social websites every post has a different size as well as their comments.
I’ve searched for a solution many of them didn’t work on iOS 14 & Swift 5 and some depend on third-party libraries so I decided to write this article.
This tutorial has two parts. First, We’re going to implement a self-sizing
UICollectionViewCell based on font size as shown in the screenshot on the left side.
Second we’re going to build a dynamic height
Swift came with a magnificent concept called an
Extension , allowing us to extend any existing
Object and add a new feature or functionality without having access to the source code. The most common example of that capability is extending a visual Visual component of
Today I want to share with you three ideas that I use in every iOS App to enlist extensions principal and to get a cleaner code.
UITableView depend too much on delegate pattern to pass the data, that would participate in creating…
Introduced with iOS13 came the
UIMenu, providing an easy way of showing a ContextMenu and allowing the users to interact with your application. Using this in a popup menu with the two event types: simple Touch and Long-Press, gives the developer a considerable amount of creative freedom.
With the release of iOS14, Apple added more controls to the ContextMenu. This meant we could now add both a
UIBarButtonItem to our popup menu!
In this tutorial, we will look at building a native and interactive popup menu with ContextMenu. First, we will look at the steps of implementing a
Apple has updated the
UIScrollView in iOS11 by the two guides:
Today I will explain how to set up auto layout constraints for
We start by adding a
UIScrollView to our
ViewController and adding four constraints with 0 to the
When working with Restful APIs, we typically want to divide the fetched data into multiple pages and not load all data at once. As a result, we have to gradually load the data as soon as the user reached the bottom of the previously fetched data. From a UX perspective, we have to inform the user that we’re loading more results when he gets the end of UICollectionView. There are many Cocoapod libraries to show an UIActivityIndicatorView at the bottom of an UICollectionView. Still, I believe that the issue is too small and simple to fix by installing third-party libraries…
Auto layout allows us to create adaptive screens that are should be equally compatible with all screen sizes and orientations, The constraints make sure our views will adjust to any size changes without having to manually update frames or positions.
Writing constraints can be quite exhausting if you write the code programmatically using pure UIKit. Today, I’ll show you how to make extension methods which would make it easier.
When you use UICollectionView you have to put a lot of UI views on storyboard to notify the user about the current status, for instance, we might put UIActivityIndicatorView while fetching data from API Services or another common example when there are no results that are matched the search filters.
So that would create a kind of repetition when our app has many UIActivityIndicatorView views, as a result, we are going to introduce an extension for UICollectionView to call it whenever we want that without adding any extra view into our storyboard as shown below in document outline.
Full Stack Web & iOS Developer