Skip to content

Commit 6eb3490

Browse files
committed
Color brightness sample
1 parent bb6dd38 commit 6eb3490

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

SwiftUIPlayground/Samples.swift

+6
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,10 @@ public let samples: [String: AnyView] = [
174174
"Progress Indicator Arc": AnyView(ProgressIndicatorArcSample()),
175175
]
176176
)),
177+
"View": AnyView(SamplesList(
178+
title: "View", samples:
179+
[
180+
"Color Brightess": AnyView(ColorBrightnessSample()),
181+
]
182+
)),
177183
]

SwiftUIPlayground/Samples/CustomLayout/LayoutProtocolSample.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct BackslashStack: Layout {
4343
return combinedSize
4444
}
4545

46-
func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache _: inout ()) {
46+
func placeSubviews(in bounds: CGRect, proposal _: ProposedViewSize, subviews: Subviews, cache _: inout ()) {
4747
let subviewSizes = subviews.map { proxy in
4848
proxy.sizeThatFits(.unspecified)
4949
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// ColorBrightnessSample.swift
3+
// SwiftUIPlayground
4+
//
5+
// Created by Taha Tesser on 20.12.2024.
6+
//
7+
8+
import SwiftUI
9+
10+
struct ColorBrightnessSample: View {
11+
var body: some View {
12+
ForEach(0 ..< 8) { num in
13+
Color.purple
14+
.brightness(Double(num) * -0.1)
15+
.clipShape(RoundedRectangle(cornerRadius: 16))
16+
}
17+
.padding(.horizontal)
18+
}
19+
}
20+
21+
#Preview {
22+
ColorBrightnessSample()
23+
}

0 commit comments

Comments
 (0)