SwiftUI - Add Border to One Edge of an Image

前端 未结 3 701
说谎
说谎 2021-02-04 09:07

It\'s a pretty straight-forward question - how does one apply a border effect to only the wanted edges of an Image with SwiftUI?

For example, I only want to apply a borde

3条回答
  •  走了就别回头了
    2021-02-04 09:45

    Similar to @smakus, if you don't need to control color or thickness, you can just do this:

        .overlay(Divider(), alignment: .top)
        .overlay(Divider(), alignment: .bottom)
    

提交回复
热议问题