CornerRadius.swift 928 B

123456789101112131415161718192021222324
  1. extension BackendFeatures {
  2. /// Backend methods for setting widgets' corner radii.
  3. ///
  4. /// These are used by ``View/cornerRadius(_:)``.
  5. @MainActor
  6. public protocol CornerRadius: Core {
  7. /// Create a container capable of clipping its child at the corners.
  8. ///
  9. /// If no container is necessary, this method is allowed to return `child`
  10. /// unmodified.
  11. ///
  12. /// - Parameters:
  13. /// - child: The widget being wrapped to set a corner radius for.
  14. func createCornerRadiusContainer(wrapping child: Widget) -> Widget
  15. /// Sets the corner radius of a widget (any widget). Should affect the view's border radius
  16. /// as well.
  17. ///
  18. /// - Parameters:
  19. /// - widget: The widget to set the corner radius of.
  20. /// - radius: The corner radius.
  21. func setCornerRadius(of widget: Widget, to radius: Int)
  22. }
  23. }