mirror of
https://github.com/samsonjs/ControlCenter_iOS.git
synced 2026-03-25 09:15:48 +00:00
37 lines
778 B
Swift
37 lines
778 B
Swift
//
|
|
// FancyBackground.swift
|
|
// ControlCenter_iOS
|
|
//
|
|
// Created by Sami Samhuri on 2020-06-25.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct FancyBackground<Content: View>: View {
|
|
let content: Content
|
|
|
|
init(@ViewBuilder build: () -> Content) {
|
|
self.content = build()
|
|
}
|
|
|
|
var body: some View {
|
|
ZStack {
|
|
content.hidden().overlay(
|
|
LinearGradient(
|
|
gradient: Gradient(colors: [.red, .purple, .blue]),
|
|
startPoint: .topLeading,
|
|
endPoint: .bottomTrailing
|
|
)
|
|
)
|
|
content
|
|
}
|
|
}
|
|
}
|
|
|
|
struct FancyBackground_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
FancyBackground {
|
|
Text("Hello")
|
|
}
|
|
}
|
|
}
|