AndreaMiotto / PartialSheet

A SwiftUI Partial Sheet fully customizable with dynamic height

Home Page:https://github.com/AndreaMiotto/PartialSheet/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation with SwiftUI lifecycle

benjaminleonard opened this issue · comments

Hi there, thanks for the library!

I started reintegrating an app and scene delegate file to my project so that I could install the library before I realised it wasn't necessary. I can create a pull request to add to the documentation for people using the SwiftUI lifecycle if you like? It's super simple but wasn't immediately obvious to me.

In summary:

Add the environment object to the app file:

var body: some Scene {
  WindowGroup {
    ContentView()
      .environmentObject(PartialSheetManager())
  }
}

Add the Partial View to ContentView as you would already:

struct ContentView: View {
  var body: some View {
    VStack {
      Text("Hello SwiftUI!")
        .padding()
    }
    .addPartialSheet()
  }
}

Plus adding import PartialSheet in the ContentView and App files

Thanks for this! It really helps newbies in SwiftUI like me

Useful comment, thank you!

Im getting these errors :
Screen Shot 2021-12-03 at 9 42 29 p m
s

commented

Check version 3.0 and if you still have the issue, feel free to reopen the issue