Swiftpack.co - ucargiray/PrettyBorder as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
ucargiray/PrettyBorder
A SwiftUI package for creating a custom border and background for any kind of view.
.package(url: "https://github.com/ucargiray/PrettyBorder.git", from: "1.0.1")

PrettyBorder

Description

PrettyBorder is a SwiftUI package for managing a customized border and background at any kind of view.


Preview of end result

Default implementation Customized Parameters

Parameters

Parameters are:

This parameter keeps track of view itself is enabled or not

- isEnabled : Binding<Bool> 

Those are used for customizing the border

- borderCornerRadius: CGFloat
- borderStrokeColor: Color
- borderLineWidth : CGFloat

Color customization for view itself is enabled or not

- disabledColor: Color
- enabledColor: Color

Those are used for giving padding around view itself and border

- paddingFromLeft: CGFloat
- paddingFromTop: CGFloat
- paddingFromRight: CGFloat 
- paddingFromBottom: CGFloat 

Usage

struct ContentView: View {
   
  @State private var isEnabled = false
   
   var body: some View {
       Text("Pretty Border is Awesome!")
           .onTapGesture {
               isEnabled.toggle()
           }
           .modifier(PrettyBorder(isEnabled: $isEnabled,
           borderCornerRadius: nil, borderStrokeColor: nil,
           borderLineWidth: nil, disabledColor: nil, 
           enabledColor: nil, paddingFromLeft: nil,
           paddingFromTop: nil, paddingFromRight: nil, 
           paddingFromBottom: nil))
   }
}

or

struct ContentView: View {

    @State private var isEnabled = false

    var body: some View {
        Text("Pretty Border is Awesome!")
            .onTapGesture {
            isEnabled.toggle()
        }
            .modifier(PrettyBorder(isEnabled: $isEnabled,
            borderCornerRadius: 50, 
            borderStrokeColor: .gray, borderLineWidth: 4,
            disabledColor: .red, enabledColor: .green, 
            paddingFromLeft: 5, 
            paddingFromTop: 30, paddingFromRight: 50, 
            paddingFromBottom: 10))
    }
}

GitHub

link
Stars: 2
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics