Skip to content

Instantly share code, notes, and snippets.

@rudrankriyam
Created November 3, 2019 04:49
Show Gist options
  • Save rudrankriyam/ad8fb9aaa3e2584436c4720f166218c6 to your computer and use it in GitHub Desktop.
Save rudrankriyam/ad8fb9aaa3e2584436c4720f166218c6 to your computer and use it in GitHub Desktop.
A custom modifier for creating a beautiful rounded background for your Views in SwiftUI.
//
// CustomModifier.swift
//
// Created by Rudrank Riyam on 03/11/19.
// Copyright © 2019 Rudrank Riyam. All rights reserved.
//
import SwiftUI
struct BackgroundModifier: ViewModifier {
func body(content: Content) -> some View {
content
.foregroundColor(.white)
.font(.headline)
.padding()
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
.background(RoundedRectangle(cornerRadius: 15, style: .continuous)
.fill(Color(UIColor.secondarySystemGroupedBackground)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment