SwiftUI: ViewModifier where content is an Image
In this case where the modification is specific to a particular view type, Image say, you could just add an extension on that view type directly: extension Image { func myImageModifier() -> some View { self .resizable() .aspectRatio(1.0, contentMode: .fit) .clipShape(Circle()) } } A full playground text example follows. If you add a cute otter … Read more