SwiftKickMobile / SwiftMessages

A very flexible message bar for UIKit and SwiftUI.
MIT License
7.3k stars 742 forks source link

Display only the body #377

Closed infinigent-solutions closed 4 years ago

infinigent-solutions commented 4 years ago

Here's my code:

class func showErrorMessage(message: String) {

    if !isStringEmpty(aString: message) {

        let messageView = MessageView.viewFromNib(layout: MessageView.Layout.cardView)
        messageView.configureTheme(Theme.error)
        messageView.configureContent(body: message)
                messageView.iconLabel?.isHidden = true
        messageView.iconImageView?.isHidden = true
        messageView.titleLabel?.isHidden = true
        messageView.button?.isHidden = true

        var config = SwiftMessages.Config()
        config.presentationStyle = SwiftMessages.PresentationStyle.bottom
        config.presentationContext = SwiftMessages.PresentationContext.window(windowLevel: UIWindow.Level.normal)
        config.duration = SwiftMessages.Duration.automatic
        config.dimMode = SwiftMessages.DimMode.none

        SwiftMessages.show(config: config, view: messageView)

    }

}

This is how it looks like: SwiftMessages

Please help to make the text appear in full width

wtmoose commented 4 years ago

Can you reproduce it in the demo app? I reproduced your configuration in the demo app and it looks fine. So I'd need more info from your end, such as a sample project that I can try.

IMG_0658

Also curious about this statement?

!isStringEmpty(aString: message) {
}

Isn't the normal way to do this?

guard !message.isEmpty else { return }
infinigent-solutions commented 4 years ago

@wtmoose The code in the demo works, however, can you please tell me where am I going wrong in my code as I'm using the latest pods for this

wtmoose commented 4 years ago

Here's a sample project containing your code and the layout looks correct.

SwiftMessagesTest.zip

You'll need to give me a way to reproduce your problem, preferably by attaching a sample project.