Open in app

Sign In

Write

Sign In

Ronak Patel
Ronak Patel

16 Followers

Home

About

Pinned

SwiftUI: Display Image from URL.

From iOS 15.0+, apple has introduced AsyncImage. AsynceImage: A view that asynchronously loads and displays an image. This view uses the shared URLSession instance to load an image from the specified URL, and then display it. For example, you can display an icon that’s stored on a server: AsyncImage(url: URL(string: “https://example.com/image.png")) .frame(width: 200, height: 200) You can specify a custom placeholder using init(url:scale:content:placeholder:).

Swiftui

1 min read

Swiftui

1 min read


Pinned

Navigation from one screen to another screen in SwiftUI

Apple provides two ways to navigate from one screen to another. Navigation (Push and Pop) Present and Dismiss Here, we’ll look Navigation (Push and Pop) , Step1. Create one extension for View, This is a generic modifier you can use it multiple times in a view for multiple button navigation. …

Navigation

1 min read

Navigation

1 min read


Sep 8, 2022

SwiftUI: Working with Picker

Picker is a control that allows you to select a value from a set of mutually exclusive values. You create a picker by providing a selection binding, a label, and the content for the picker to display. Set the selection parameter to a bound property that provides the value to…

Swiftui

2 min read

SwiftUI: Working with Picker
SwiftUI: Working with Picker
Swiftui

2 min read


Aug 19, 2022

SwiftUI: How to observe a TextField value

TextField : A control that displays an editable text interface. Multiple ways to observe the SwiftUI TextField value Using Closure Using onChange modifier Using Publisher(Combine) import SwiftUI import Combine struct ContentView: View { @State private var Text1 = "" @State private var Text2 = "" @ObservedObject var viewModel = ObserveTextFieldValue() var body: some View { //MARK: Using Closure TextField("Enter text1", text: $Text1){ editing in print(editing) }onCommit: { print("Committed") }

Combine

1 min read

Combine

1 min read


Aug 3, 2022

SwiftUI: TextField max limit

TextField is a control that displays an editable text interface. In this blog, we’ll learn how to set the maximum limit of a text in Textfield using Combine. The most elegant (and simple) way to set a character limit on the TextField is to use the native publisher event collect(). …

Swiftui

1 min read

Swiftui

1 min read


Jun 17, 2022

SwiftUI: List API Call

In this post we are going to take a look at how we can get JSON data from an API and show it in a list view in SwiftUI. Let’s jump right in and get started by creating a new SwiftUI project. Our expected output: Step1: Create a UserDetails model…

Swiftui

2 min read

SwiftUI: List API Call
SwiftUI: List API Call
Swiftui

2 min read


May 28, 2021

Present and Dismiss a sheet in SwiftUI

A sheet in iOS is a system provided view that appears modally on top of any other currently displayed view. A sheet is by default empty, we need to provide it with custom views and content. Instance method: .sheet(isPresented:onDismiss:content:) Parameters: isPresentedA binding to a Boolean value that determines whether to…

Swiftui Modal Sheet

1 min read

Swiftui Modal Sheet

1 min read


May 27, 2021

Apple Signing SwiftUI

The easiest way to Sign in with Apple using SwiftUI. SignInWithAppleButton The view that creates the Sign in with Apple button for display. SignInWithAppleButton(.signIn) { request in request.requestedScopes = [.email , .fullName] } onCompletion: { result in switch result { case .success(let authResults): print("Authorisation successful") case .failure(let error): print("Authorisation failed: \(error.localizedDescription)")

Swiftui

1 min read

Swiftui

1 min read


Sep 21, 2020

Unit and UI testing in iOS

Introduction: XCTest is Xcode’s testing framework. It is a base class used to create and run unit tests, performance tests, and UI tests for your Xcode project. It consists 2 main important methods, 1)setUp():- setUp is called before each of the test case is executed. 2)tearDown():- tearDown() is called after the…

Swift

3 min read

Unit and UI testing in Xcode
Unit and UI testing in Xcode
Swift

3 min read


Sep 14, 2020

Image extension/format from UIImage in swift

If you want to restrict the user to select only particular UIImage format such as JPEG, PNG , JPG. You can use one condition inside this imagePickerController() function, func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { let assetPath = info[UIImagePickerControllerReferenceURL] as! NSURL if (assetPath.absoluteString?.hasSuffix("JPG"))! { print("This is JPG Image") } else if (assetPath.absoluteString?.hasSuffix("PNG"))! { print("This is PNG Image") } else if (assetPath.absoluteString?.hasSuffix("GIF"))! { print("This is GIF Image") } else { print("Other Formats are not allowed like .tiff , .gif") } }

Swift

1 min read

Swift

1 min read

Ronak Patel

Ronak Patel

16 Followers

iOS Developer

Following
  • Bennett Garner

    Bennett Garner

  • Eva Rtology

    Eva Rtology

  • Phil from 4 day week

    Phil from 4 day week

  • Elisabeth Roberts

    Elisabeth Roberts

  • Paul Allies

    Paul Allies

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech