Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created March 2, 2021 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azamsharp/8abbd76a1ab33d6bcbe9c7fd392512bc to your computer and use it in GitHub Desktop.
Save azamsharp/8abbd76a1ab33d6bcbe9c7fd392512bc to your computer and use it in GitHub Desktop.
//
// ContentView.swift
// GradientsinSwiftUI
//
// Created by Mohammad Azam on 3/2/21.
//
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
}.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(AngularGradient(gradient: Gradient(colors: [Color.red, Color.blue, Color.yellow, Color.green, Color.purple, Color.pink]), center: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/))
.edgesIgnoringSafeArea(.all)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
/* LINEAR GRADIENT
struct ContentView: View {
var body: some View {
VStack {
}.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(LinearGradient(gradient: Gradient(colors: [Color(#colorLiteral(red: 0.6090738773, green: 0.346663475, blue: 0.7139347196, alpha: 1)), Color(#colorLiteral(red: 0.9060251117, green: 0.2971941829, blue: 0.2339707017, alpha: 1))]), startPoint: .top, endPoint: .bottom))
.edgesIgnoringSafeArea(.all)
}
}
*/
/* RADIAL GRADIENT
struct ContentView: View {
var body: some View {
VStack {
}.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(RadialGradient(gradient: Gradient(colors: [Color.red, Color.blue]), center: .topLeading, startRadius: 5, endRadius: 900))
.edgesIgnoringSafeArea(.all)
}
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment