-
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.
viewPostion for Sheet is created, and sheet is complte
- Loading branch information
1 parent
1d5af70
commit e725d45
Showing
8 changed files
with
50 additions
and
230 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
Bilbary for iPhone/iiPhone Models/CustomSheetDragGesture.swift
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,33 @@ | ||
// | ||
// SheetPosition.swift | ||
// Bilbary for iPhone | ||
// | ||
// Created by SHOHJAHON on 02/08/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
// Custom View Extension which will return View Position | ||
|
||
struct PositionKey: PreferenceKey { | ||
static var defaultValue: CGFloat = .zero | ||
|
||
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) { | ||
value = nextValue() | ||
} | ||
} | ||
extension View { | ||
@ViewBuilder | ||
func viewPosition( completion: @escaping (CGFloat) -> Void) -> some View { | ||
self | ||
.overlay { | ||
GeometryReader { | ||
let y = $0.frame(in: .global).minY | ||
|
||
Color.clear | ||
.preference(key: PositionKey.self, value: y) | ||
.onPreferenceChange(PositionKey.self, perform: completion) | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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