Skip to content

Instantly share code, notes, and snippets.

@haneenmahd
Created October 5, 2022 13:37
Show Gist options
  • Save haneenmahd/cc37178f133f2f3ba771628a5cd23528 to your computer and use it in GitHub Desktop.
Save haneenmahd/cc37178f133f2f3ba771628a5cd23528 to your computer and use it in GitHub Desktop.
Dynamic Island in SwiftUI! (Getting the values for our layout)
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