Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to add overlay in SwiftUI #302

Open
dosht opened this issue Dec 25, 2022 · 1 comment · May be fixed by #311
Open

Trying to add overlay in SwiftUI #302

dosht opened this issue Dec 25, 2022 · 1 comment · May be fixed by #311
Labels
enhancement New feature or request

Comments

@dosht
Copy link

dosht commented Dec 25, 2022

I'm trying to add something like CurrentLineView to display other information like Sunrise and Sunset, but I can't access the scroll position or something similar to calculate its position. Do you have an idea how I can do this?
Here is my code to explain what I'm trying to do:

struct CalendarContentView: View {
    @ObservedObject var viewModel: CalendarViewModel = CalendarViewModel()
    @State var test: String = "test"
    
    var body: some View {
        GeometryReader { geo in
            CalendarDisplayView(events: $viewModel.events, geo: geo, test: $test)
                .overlay {
                    ZStack {
                        Text("Sunrise 6:35 AM")
                            .position(x: 110, y: geo.size.height / 2 - 12)
                            .foregroundColor(Color.blue)
                        Path() { path in
                            path.move(to: CGPoint(x: 44, y:  geo.size.height / 2 - 1))
                            path.addLine(to: CGPoint(x: 44, y:  geo.size.height / 2))
                            path.addLine(to: CGPoint(x: geo.size.width, y:  geo.size.height / 2))
                            path.addLine(to: CGPoint(x: geo.size.width, y:  geo.size.height / 2 - 1))
                        }.fill(Color.blue)
                    }
                }
        }
    }
}

simulator

@kvyatkovskys
Copy link
Owner

Hello @dosht !

hm, interesting... Looks like need to get access to scrollView from UIKit 🤔

@kvyatkovskys kvyatkovskys added the enhancement New feature or request label Dec 29, 2022
@kvyatkovskys kvyatkovskys linked a pull request Apr 23, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants