SebastianBoldt/Jelly

Having a few issues upgarding

Closed this issue · 8 comments

Couple issues while upgrading

When running the exact example in the wiki for customizable options shown below

let allCorners = [.layerMaxXMaxYCorner,.layerMaxXMinYCorner,.layerMinXMaxYCorner,.layerMinXMinYCorner]

let uiConfiguration = PresentationUIConfiguration(cornerRadius: 10, 
                                                  backgroundStyle: .blurred(effectStyle: .dark),           
                                                  isTapBackgroundToDismissEnabled: true, 
                                                  corners: allCorners )

let size = PresentationSize(width: .fullscreen, height: .fullscreen)

let alignment = PresentationAlignment(vertical: .center, horizontal: .center)

let marginGuards = UIEdgeInsets(top: 40, left: 16, bottom: 40, right: 16)

let timing = PresentationTiming(duration: .normal, presentationCurve: .linear, dismissCurve: .linear)

let interactionConfiguration = InteractionConfiguration(presentingViewController: self, 
                                                        completionThreshold: 0.5, 
                                                        dragMode: .canvas)

let presentation = CoverPresentation(directionShow: .left, 
                                     directionDismiss: .left, 
                                     uiConfiguration: uiConfiguration, 
                                     size: size, 
                                     alignment: alignment, 
                                     marginGuards: marginGuards, 
                                     timing: timing, 
                                     spring: .none, 
                                     interactionConfiguration: interactionConfiguration)

I had to hint to the compiler it was an options set with

let allCorners: CACornerMask = [.layerMaxXMaxYCorner,.layerMaxXMinYCorner,.layerMinXMaxYCorner,.layerMinXMinYCorner]

I'm also not sure how to migrate old usage to new usage, for example:

var presentation = JellySlideInPresentation()
presentation.widthForViewController = .custom(value: 295)
presentation.heightForViewController = .custom(value: 173)

The new signature of SlidePresentation takes a size of type Size where CoverPresentation takes a size of PresentationSize, so i'm not sure what to do here

Here's the entirety of legacy code, maybe i'm translating the intent incorrectly, makes it a bit harder when code you're reading isn't yours ;)

guard let dialogue = storyboard?.instantiateViewController(withIdentifier: "StartChallengeDialogueVC") else { return }
        var presentation = JellySlideInPresentation()
        presentation.directionShow = .bottom
        presentation.directionDismiss = .bottom
        presentation.widthForViewController = .custom(value: 295)
        presentation.heightForViewController = .custom(value: 173)
        presentation.cornerRadius = 6
        presentation.presentationCurve = .easeInEaseOut
        presentation.dismissCurve = .easeInEaseOut
        presentation.backgroundStyle = .blur(effectStyle: .dark)
        presentation.jellyness = .jelly
        jellyAnimator = JellyAnimator(presentation: presentation)
        jellyAnimator?.prepare(viewController: dialogue)
        present(dialogue, animated: true, completion: nil)

Hi Roman, thanks for finding out that the wiki example is incorrect. I'll take care of it.

As for your code, I first noticed that you had a slide presentation back then.
Slide became Cover in Jelly 2.0.0
and ShiftIn -> Slide.

Slide just uses a Size Object because it has just one dimension of size depending on the direction.
Cover takes a PresentatinSize with width and height encapsulated and will be used on fade and cover presentations.

This should represent your old presentation in Jelly 2.0
@rromanchuk

let uiConfiguration = PresentationUIConfiguration(cornerRadius: 6, backgroundStyle: .blurred(effectStyle: .dark))
let size = PresentationSize(width: .custom(value: 295), height: .custom(value: 173))
let timing = PresentationTiming(duration: .normal, presentationCurve: .easeInOut, dismissCurve: .easeInOut)
let presentation = CoverPresentation(directionShow: .bottom,
                                             directionDismiss: .bottom,
                                             uiConfiguration: uiConfiguration,
                                             size: size,
                                             timing: timing,
                                             spring: .medium)

Attributes are your friend

@available(*, deprecated: 2.0.0, renamed: "whatever(meh:)")

@rob-nash Thanks. Thanks, I didn't know about that yet.

No worries @SebastianBoldt thanks for building this. Looks great.

Public API implications is worth reading. This YouTube rant by Rich Hickey is also great.

I'm looking forward to what you do next.

@rromanchuk Did the code help? I would close the ticket as soon as you give positive feedback ;)

Thanks! I'll get back to it today. Closing for now