SwiftEntryKit
SwiftEntryKit copied to clipboard
Have EKSimpleMessageView and others be open class for custom inheritance
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is.
I am trying to have the thumbImageView of the EKSimpleMessageView be centered within its container, but it seems hardcoded on 16
Describe the solution you'd like A clear and concise description of what you want to happen.
I would like to have control over the positioning of the image, otherwise I would like to subclass EKSimpleMessageView or other views and setup a custom layout.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered. I have tried to create my own view (customView: UIView(...size(100, 20) ) and pass it to: SwiftEntryKit.display(entry: customView, using: attributes)
But the ViewHierarchy says that the view height is 0, width is still fine.
Additional context Add any other context or screenshots about the feature request here.
Try this
var attributes = EKAttributes.bottomFloat
// ommited code
let title = EKProperty.LabelContent(text: "NO INTERNET CONNECTION", style: .init(font: .systemFont(ofSize: 14, weight: .medium), color: EKColor(.label), alignment: .center))
let description = EKProperty.LabelContent(text: "Functionality will be limited", style: .init(font: .systemFont(ofSize: 12, weight: .regular), color: EKColor(.secondaryLabel), alignment: .center))
var image: EKProperty.ImageContent?
if #available(iOS 13.0, *) {
image = EKProperty.ImageContent(image: UIImage(systemSymbol: .wifiSlash))
image?.tint = EKColor(.label)
}
// Change insets here
var a = EKNotificationMessage.Insets.default
a.contentInsets = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16)
let simpleMessage = EKSimpleMessage(image: image, title: title, description: description)
let notificationMessage = EKNotificationMessage(simpleMessage: simpleMessage, insets: a) <-- pass insets here
let contentView = EKNotificationMessageView(with: notificationMessage)
// Show alert
SwiftEntryKit.display(entry: contentView, using: attributes, presentInsideKeyWindow: false)