-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b95f89b
commit 98bf05c
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
Binary file modified
BIN
-5.75 KB
(94%)
...proj/project.xcworkspace/xcuserdata/tahatesser.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
SwiftUIPlayground/Samples/LayoutFundamentals/ViewThatFitsSample.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// ViewThatFitsSample.swift | ||
// SwiftUIPlayground | ||
// | ||
// Created by Taha Tesser on 10/6/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ViewThatFitsSample: View { | ||
var body: some View { | ||
VStack { | ||
UploadProgressView(uploadProgress: 0.75) | ||
.frame(maxWidth: 200) | ||
UploadProgressView(uploadProgress: 0.75) | ||
.frame(maxWidth: 100) | ||
UploadProgressView(uploadProgress: 0.75) | ||
.frame(maxWidth: 50) | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
ViewThatFitsSample() | ||
} | ||
|
||
struct UploadProgressView: View { | ||
var uploadProgress: Double | ||
|
||
var body: some View { | ||
ViewThatFits(in: .horizontal) { | ||
HStack { | ||
Text("\(uploadProgress.formatted(.percent))") | ||
ProgressView(value: uploadProgress) | ||
.frame(width: 100) | ||
} | ||
ProgressView(value: uploadProgress) | ||
.frame(width: 100) | ||
Text("\(uploadProgress.formatted(.percent))") | ||
} | ||
|
||
} | ||
} |