Skip to content
Codeplayon
  • Home
  • AI
  • Blog
  • technology
  • Tech Interview
  • Apps
Login Page Design in SwiftUI

Create a Login Page in SwiftUI – using swiftui button & textfield, Image

February 7, 2024January 11, 2024 by Parmit Singh

Hi developer in this iOS swiftUi tutorial i am share how to design a login page in swiftUi. using SwiftUI Button, Textfield & image. like gmail login page, facebook login page etc. With make customized button ui and image.

What is Login page in SwiftUi .

Table of Contents

Toggle
  • What is Login page in SwiftUi .
  • mychart login page swiftUi Example.
  • mychart login page Full Source code Example.

A login page specifies the login URL in a web application that users must pass through to get to the authenticated URLs at the heart of the application. Authenticated URLs are URLs that become accessible to users only after they successfully log in to the login URL.

A login page is a door that users must open in order to get the best out of their user experience with a website. It is the starting point of navigating a website in a personalized manner.

so let’s start to create a login page Ui you just follow below code.

mychart login page swiftUi Example.

let’s create a new ios project selecting with swifitUi and follow the below code. in the body view firstly use the Vstack and then use a Text after the showing a image.

 

SwiftiUI Text For App Tital

   Text("Login")

                .font(.largeTitle).foregroundColor(Color.white)
                .padding([.top, .bottom], 40)
                .shadow(radius: 10.0, x: 20, y: 10)

 

Swifit UI Image with Circle  for Logo

Image(systemName: "apple.logo")

                .resizable()

                .frame(width: 80, height: 80)

                .padding(.all, 20)

                .overlay(Circle().stroke(Color.white, lineWidth: 2))

                .shadow(radius: 10.0, x: 20, y: 10)

                .padding(.bottom,40)

 

TextField SwiftUI for Enter Email ID

TextField("Email", text: self.$email)

                    .padding()

                    .background(Color.themeTextField)

                    .cornerRadius(20.0)

                    .shadow(radius: 10.0, x: 20, y: 10)

 

SwiftUI  SecureField for Password

SecureField("Password", text: self.$password)

                    .padding()

                    .background(Color.themeTextField)

                    .cornerRadius(20.0)

                    .shadow(radius: 10.0, x: 20, y: 10)

            }.padding([.leading, .trailing], 27.5)

            

SwiftUI Button for Login Button

Button(action: {


            }) {

                Text("Sign In")

                    .font(.headline)

                    .foregroundColor(.white)

                    .padding()

                    .frame(width: 300, height: 50)

                    .background(Color.green)

                    .cornerRadius(15.0)

                    .shadow(radius: 10.0, x: 20, y: 10)

            }.padding(.top, 50)

 

 

also i am using VStack and HStack for mange the UI field vertical and horizontally. you can find complete code below.

 

mychart login page Full Source code Example.

import Foundation

import SwiftUI

struct LoginView: View {

    // MARK: - Propertiers

    @State private var email = ""

    @State private var password = ""

    

    // MARK: - View

    var body: some View {

        VStack() {

            Text("Login")

                .font(.largeTitle).foregroundColor(Color.white)

                .padding([.top, .bottom], 40)

                .shadow(radius: 10.0, x: 20, y: 10)

            

            Image(systemName: "apple.logo")

                .resizable()

                .frame(width: 80, height: 80)

                .padding(.all, 20)

                .overlay(Circle().stroke(Color.white, lineWidth: 2))

                .shadow(radius: 10.0, x: 20, y: 10)

                .padding(.bottom,40)

                

            

            VStack(alignment: .leading, spacing: 15) {

                TextField("Email", text: self.$email)

                    .padding()

                    .background(Color.themeTextField)

                    .cornerRadius(20.0)

                    .shadow(radius: 10.0, x: 20, y: 10)

                

                SecureField("Password", text: self.$password)

                    .padding()

                    .background(Color.themeTextField)

                    .cornerRadius(20.0)

                    .shadow(radius: 10.0, x: 20, y: 10)

            }.padding([.leading, .trailing], 27.5)

            

            Button(action: {

                

            }) {

                Text("Sign In")

                    .font(.headline)

                    .foregroundColor(.white)

                    .padding()

                    .frame(width: 300, height: 50)

                    .background(Color.green)

                    .cornerRadius(15.0)

                    .shadow(radius: 10.0, x: 20, y: 10)

            }.padding(.top, 50)

            

            Spacer()

            HStack(spacing: 0) {

                Text("Don't have an account? ")

                Button(action: {}) {

                    Text("Sign Up")

                        .foregroundColor(.white)

                }

            }

        }

        .background(

            LinearGradient(gradient: Gradient(colors: [.red, .blue]), startPoint: .top, endPoint: .bottom)

                .edgesIgnoringSafeArea(.all))

        

    }

}

extension Color {

    static var themeTextField: Color {

        return Color(red: 220.0/255.0, green: 230.0/255.0, blue: 230.0/255.0, opacity: 1.0)

    }

}

struct LoginView_Previews: PreviewProvider {

    static var previews: some View {

        LoginView()

    }

}

read more android, iOS , Flutter tutorial and example on codeplayon. happy coding if it helpful for your learn share and explore more.

Read More Tutorial 

  • Codeplayon Jetpack Compose Tutorial 
  • Codeplayon Android Tutorial 
  • Codeplayon Flutter Tutorial 
  • Codeplayon on Github
Categories iOS Tags Login Page, Login Page Design, SwiftUI Login Page
filmymeet5 : Facts About You Should Know 2025
Create a Weather iOS APP UI with Sunrise And Sunset View in SwiftUI
  • 5g technology
  • AI
  • Android development
  • Android Kotlin
  • Android tutorial
  • Apps
  • Blockchain
  • Blog
  • Data Structure
  • E-learning
  • entertainment
  • Fitness
  • Flutter Tutorial
  • gaming
  • iOS
  • IoT technology – internet of things
  • Jetpack Compose
  • LTE Tutorial Long-Term Evolution 
  • news
  • social networking
  • Sponsored Post
  • Streaming
  • Tech Interview
  • technology
  • Uncategorized
  • Website Reviews
Sitemap.Html
  • Paying for AI Twice: Satya Nadella’s Warning Explained
  • Why OpenAI Killed Atlas: The Strategic Shift to ChatGPT Work
  • Boom Sports Promo Code FOXSPORTS: Play $5, Get $40 Free
  • How IObit Uninstaller Helped Me Completely Remove Programs and Leftover Files
  • Inside the SpaceX AI Handset Prototype: Truth vs. Denial
© 2026 Codeplayon • Built with GeneratePress