Skip to main content

Posts

Showing posts from September, 2020

Custom Loader (Activity Indicator) in Swift

Creating a custom activity indicator in Swift allows you to tailor the appearance and behavior of your loading spinner to fit the style of your app. Here's a step-by-step guide to creating a simple custom activity indicator using UIView Step 1: Create a New Swift File for the Custom Activity Indicator Create a new Swift file and name it  RotatingCirclesView.swift . Add the following code to define a custom UIView subclass for your activity indicator: // //   RotatingCirclesView.swift //   Welcome In // //   Created by Praveen Kumar on 05/09/24. // import UIKit class RotatingCirclesView : UIView {          let circle1 = UIView ( frame : CGRect ( x : 20 , y : 20 , width : 60 , height : 60 ))     let circle2 = UIView ( frame : CGRect ( x : 120 , y : 20 , width : 60 , height : 60 ))          let position : [ CGRect ] = [ CGRect ( x : 30 , y : 20 , width : 60 , height : 60 ), CGRect ( x : 60 , y : 15 ,...

JSON Parsing with Codable in Swift - Nested JSON Model

#Swift, to supporting decoding and encoding we must adopt the #NSCoding protocol and implement its methods.  #Apple has introduced a new way to decode and encode the #JSON data using with Codable since Swift 4.  You need to consume the following API to search and display images. - Flickr Https://www.flickr.com/services/api/flickr.photos.search.htm The API results in search results for a Documentation on this page to get the image URLS: https://www.flickr.com/services/api/misc.urls.html XXXXXXXX -  API Key Open Test Api -  https://api.flickr.com/services/rest/?method=flickr.galleries.getPhotos&api_key=XXXXXXXX&gallery_id=66911286-72157647277042064&format=json&nojsoncallback=1 Model: -  import Foundation struct ResponseCodable : Codable {     let photos : Photos ?     let stat : String ?     enum CodingKeys : String , CodingKey {         case photos = "photos"        ...