getsidetrack / swiftui-pipify

A SwiftUI component for launching custom picture-in-picture experiences
MIT License
155 stars 14 forks source link

Breaking Changes: API update and package rename #18

Closed Sherlouk closed 2 years ago

Sherlouk commented 2 years ago
@State var showPip = false

someView
  .pipify(isPresented: $showPip) // uses self as the view (morph effect)

// or

someView
  .pipify(isPresented: $showPip) {
    SomeOtherView() // uses view in closure as the view (fade effect)
  }

// optional:
// in your view you can add the controller as an environment object

@EnvironmentObject var controller: PipifyController

// this gives you access to the renderSize etc
// alternatively:

yourPipifyView
    .onPipRenderSizeChanged { size in
        // new size goes here
    }

Closes #5 Closes #10

Sherlouk commented 2 years ago

The environment object ~should (untested)~ makes it easier to add new modifiers in the future such as:

.onPipPlayPause { }
.onPipSkip { } // what a fun rhyme
.onPipStart { } // binding change
.onPipStop { } // redock, close or binding change

which makes #10 much easier and nicer.

Sherlouk commented 2 years ago

Added some modifiers (as per previous comment) with exception to skip 👍 That's for later/tomorrow. Time to chill for a bit 😛

Sherlouk commented 2 years ago

looks like the modifiers don't work for morphing views, but work fine for external views

happy to merge like this for now, morphing is a less desirable feature for me personally

Sherlouk commented 2 years ago

added support for skip buttons added support for progress bar

closes #10