Created
October 5, 2022 13:37
-
-
Save haneenmahd/cc37178f133f2f3ba771628a5cd23528 to your computer and use it in GitHub Desktop.
Dynamic Island in SwiftUI! (Getting the values for our layout)
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
import SwiftUI | |
struct ContentView: View { | |
let width = 0.95 * UIScreen.main.bounds.width | |
let height: CGFloat = 220 | |
let x = UIScreen.main.bounds.width / 2 | |
let y: CGFloat = 120 | |
var body: some View { | |
ZStack { | |
Image("wallpaper") // get the assets here: https://github.com/haneenmahd/DynamicIsland-assets | |
.resizable() | |
.scaledToFill() | |
} | |
.preferredColorScheme(.dark) | |
.ignoresSafeArea() | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment