Skip to content

Instantly share code, notes, and snippets.

@juanjovn
Last active May 8, 2024 13:12
Show Gist options
  • Save juanjovn/104c3ea2cfec981bd13de3a71f00199a to your computer and use it in GitHub Desktop.
Save juanjovn/104c3ea2cfec981bd13de3a71f00199a to your computer and use it in GitHub Desktop.
Nice banners with gradient and symbols background
//
// 🌯⚡️ UI Components included in WrapFast SwiftUI Starter Kit: https://WrapFa.st
//
import SwiftUI
import SymbolOverlayKit
struct PremiumBannerView: View {
@State var color: Color = .blue
var body: some View {
ZStack {
RoundedRectangle(cornerRadius: 16)
.foregroundStyle(color.gradient)
.frame(maxWidth: .infinity, maxHeight: 72)
.symbolOverlayRoundedRectangle(symbol: "crown.fill", size: 25, color: .bone, opacity: 0.1, rotation: -10, vspacing: 20, hspacing: 15, rectangleCornerRadius: 15)
HStack {
PremiumBadgeView()
.frame(height: 40)
.padding(.leading)
Text("Unlock Premium Features")
.font(.system(.title2, weight: .bold))
.foregroundStyle(.white)
.lineLimit(1)
.minimumScaleFactor(0.8)
.frame(maxWidth: .infinity, alignment: .leading)
}
Spacer()
}
}
}
struct PremiumBadgeView: View {
var body: some View {
Image(systemName: "crown.fill")
.resizable()
.scaledToFit()
.foregroundStyle(.yellow)
.padding(8)
.background(.customBackground)
.cornerRadius(12)
}
}
#Preview {
PremiumBannerView(color: .blue)
.padding()
}
@juanjovn
Copy link
Author

juanjovn commented May 8, 2024

More components like this in the SwiftUI iOS boilerplate WrapFast 🌯⚡️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment