Thursday, June 27, 2019

How to create custom Image view in SwiftUI?

Open Xcode and either click Create a new Xcode project in Xcode’s startup window, or
choose File > New > Project.
In the template selector, select iOS as the platform, select the Single View Apptemplate, and then
click Next.

Enter “CustomImage” as the Product Name, select the Use SwiftUI checkbox, and click Next.
Choose a location to save the project on your Mac.

In Canvas on the right click Resume to display the preview. If the canvas is hidden select Editor >
Editor and Canvas to show it.

First we need to add custom image to Assets folder. Drag drop SwiftUi image to mentioned folder.
Image view can be inserted using Image(_:) initializer.  In ContentView replace Text view with Image view and name of Image .
To make image Circular we need to add  a call to clipShape(Circle()) to apply the circular clipping
shape to the image. The Circle type is a shape that you can use as a mask, or as a view by giving the
circle a stroke or fill.
To add a border to our image view, another circle with a black stroke should be created and then add it as
an overlay to give the image a border.
By adding resizeable() property and using frame property we can width , height and alignment of image.


  1. clipping path is the procedure of creating an introduction around a center item while the rest of the photo is being made transparent.
    All you call for to know about the perfect clipping path company see our website.

  2. Digital camera technology has enabled even the most novice photographer to capture images in stunning detail and clarity. The most obvious source for free images is simply using a personal digital camera.Photo Retouching Service

  3. Thanks so much for sharing this awesome info! I am looking forward to see more postsby you! explanation