- August 12, 2025
- Mins Read
Simple Loading Animation Button for SwiftUI
📹 Preview
File ➜ Swift Packages ➜ Add Package Dependancy..
.package(url: “https://github.com/Changemin/LoadingButton”, from: “1.1.2”)
LoadingButton(action: { }, isLoading: <Binding>Bool, style: LoadingButtonStyle) {
// View on the button
// style is optional parameter
action
: Actions to do when button clickedisLoading
: <Binding>Bool
type. you can control loading status with this.style
(Optional) : Custom style with LoadingButtonStyle
LoadingButtonStyle(width: CGFloat,
height: CGFloat,
cornerRadius: CGFloat,
backgroundColor: Color,
loadingColor: Color,
strokeWidth: CGFloat,
strokeColor: Color)
// All of the parameter is optional
width
(Optional) : Width of buttonheight
(Optional) : Height of buttoncornerRadius
(Optional) : Corner radius of buttonbackgroundColor
(Optional) : Background color of buttonloadingColor
(Optional) : Background color of button when Loading
, default is 50% opacity of backgroundColor
strokeWidth
(Optional) : Circle loading indicator stroke widthstrokeColor
(Optional) : Circle loading indicator stroke Color(default: gray)
import SwiftUI
import LoadingButton
struct ContentView: View {
@State var isLoading: Bool = false
var body: some View {
LoadingButton(action: {
// Your Action here
}, isLoading: $isLoading) {
Text(“LoadingButton”).foregroundColor(Color.white)
}
}
}
import SwiftUI
import LoadingButton
struct ContentView: View {
@State var isLoading: Bool = false
var style = LoadingButtonStyle(width: 312,
height: 54,
cornerRadius: 27,
backgroundColor: .orange,
loadingColor: Color.orange.opacity(0.5),
strokeWidth: 5,
strokeColor: .gray)
var body: some View {
LoadingButton(action: {
// Your Action here
}, isLoading: $isLoading, style: style) {
Text(“Styled LoadingButton”).foregroundColor(Color.white)
}
}
}
import SwiftUI
import LoadingButton
struct ContentView: View {
@State var isLoading: Bool = false
var body: some View {
LoadingButton(action: {
// Your Action here
}, isLoading: $isLoading, style: LoadingButtonStyle(cornerRadius: 27, backgroundColor: .orange)) {
Text(“Styled LoadingButton”).foregroundColor(Color.white)
}
}
}
Recognize your user's voice elegantly without having to figure out authorization and audio engines. SwiftSpeech Examples Features Installation Getting Started ...
Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 14.0 Installation ...
SlidingRuler is a Swift package containing a SwiftUI control that acts like an linear infinite slider or a finite, more precise ...
SkeletonUI aims to bring an elegant, declarative syntax to skeleton loading animations. Get rid of loading screens or spinners and ...