Skip to content

Instantly share code, notes, and snippets.

@haneenmahd
haneenmahd / ContentView.swift
Created October 5, 2022 17:09
Dynamic Island in SwiftUI (Closing and Open the Dynamic Island)
import SwiftUI
struct DynamicView: View {
let width = 0.95 * UIScreen.main.bounds.width
let height: CGFloat = 200
let x = UIScreen.main.bounds.width / 2
let y: CGFloat = 110
let closedWidth = 0.6 * UIScreen.main.bounds.width
let closedHeight: CGFloat = 40
@haneenmahd
haneenmahd / ContentView.swift
Created October 5, 2022 15:13
Dynamic Island in SwiftUI! (Setting up the layout)
import SwiftUI
struct DynamicView: View {
let width = 0.95 * UIScreen.main.bounds.width
let height: CGFloat = 200
let x = UIScreen.main.bounds.width / 2
let y: CGFloat = 110
var waveIcon: some View {
HStack(spacing: 3) {
@haneenmahd
haneenmahd / ContentView.swift
Created October 5, 2022 13:37
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 {
@haneenmahd
haneenmahd / ContentView.swift
Created October 5, 2022 13:34
Dynamic Island in SwiftUI
import SwiftUI
struct ContentView: View {
var body: some View {
ZStack {
Image("wallpaper") // get the assets here: https://github.com/haneenmahd/DynamicIsland-assets
.resizable()
.scaledToFill()
}
.preferredColorScheme(.dark)
@haneenmahd
haneenmahd / ripple-effect.swift
Created June 3, 2022 15:13
Ripple Effect in SwiftUI
import SwiftUI
struct ContentView: View {
@State private var firstCircle = 1.0
@State private var secondCircle = 1.0
var body: some View {
ZStack {
Circle()
.stroke(.blue)