SvenTiigi / WhatsNewKit

Showcase your awesome new app features 📱
https://sventiigi.github.io/WhatsNewKit/
MIT License
3.87k stars 190 forks source link

iPad Adjustments not work #48

Closed furiosFast closed 3 years ago

furiosFast commented 3 years ago

WhatsNewKit Environment

What did you do?

I've added this code for ipad adjustments:

configuration.padAdjustment = { configuration in

            configuration.titleView.insets.top = 25.0
            configuration.detailButton = nil

            configuration.itemsView.insets.top = -20.0
            configuration.itemsView.insets.left = 5.0
            configuration.itemsView.insets.right = 7.0
            configuration.itemsView.insets.bottom = 5.0

            configuration.completionButton.insets.bottom = 17.0

            WhatsNewViewController.Configuration.defaultPadAdjustment(&configuration)
        }

but it doesn't works. For example the detail button is still visible.

SvenTiigi commented 3 years ago

Hi @furiosFast,

Due to a recent bug report (https://github.com/SvenTiigi/WhatsNewKit/issues/45) the padAdjustment closure has been refactored to be only used to update the layout insets.

Therefore changing the detailButton to nil will have no effect inside the padAdjustment closure.

If you wish to hide the detailButton on an iPad you could update your WhatsNewKit configuration to something like this:

var configuration = WhatsNewViewController.Configuration()

configuration.detailButton = {
    if UIDevice.current.userInterfaceIdiom == .pad {
        return nil
    } else {
        return WhatsNewViewController.DetailButton(title: ..., action: ...)
    }
}()
SvenTiigi commented 3 years ago

But I will try to fix this misleading behavior within the next release of WhatsNewKit ✌️

furiosFast commented 3 years ago

ok, thank you!!

SvenTiigi commented 3 years ago

Updated README.md (https://github.com/SvenTiigi/WhatsNewKit/commit/773210d5876a567d3e19b3f38caae2f27e98a1e6) and added corresponding hint for this issue.

furiosFast commented 3 years ago

hi, even moving the lines of code however the customization for ipad does not work

configuration.padAdjustment = { configuration in
            WhatsNewViewController.Configuration.defaultPadAdjustment(&configuration)

            configuration.detailButton = nil
            configuration.itemsView.insets.top = -20.0
            configuration.itemsView.insets.left = 5.0
            configuration.itemsView.insets.right = 7.0
            configuration.itemsView.insets.bottom = 5.0
}