mirror of
https://github.com/home-assistant/iOS.git
synced 2026-04-12 05:08:23 -05:00
Refs #1591. ## Summary Adds support for using image notification attachments in the content extension. ## Screenshots <img width="350" src="https://user-images.githubusercontent.com/74188/115494743-18462900-a21b-11eb-83d5-3e6c112d99df.png"> ## Any other notes Dynamic actions require the 'DYNAMIC' category but our content extension causes attachments to not appear and we want every possible feature to work with just this category.
13 lines
360 B
Swift
13 lines
360 B
Swift
import UIKit
|
|
|
|
public extension NSLayoutConstraint {
|
|
static func aspectRatioConstraint(on view: UIView, size: CGSize) -> NSLayoutConstraint? {
|
|
guard size.height > 0 else {
|
|
return nil
|
|
}
|
|
|
|
let ratio = size.width / size.height
|
|
return view.widthAnchor.constraint(equalTo: view.heightAnchor, multiplier: ratio)
|
|
}
|
|
}
|