Post

Replies

Boosts

Views

Activity

Reply to Check if iOS 14 is available in SwiftUI body
Can confirm I'm also having issues I've attempted these as well struct StyledList: ViewModifier { 		func body(content: Content) -> some View { 				if #available(iOS 14.0, *) { 						return content 								.listStyle(InsetGroupedListStyle()) 				} else { 						return content 								.listStyle(DefaultListStyle()) 					 } 				} 		} } and extension View { 		public func styledList() -> some View { 				if #available(iOS 14.0, *) { 						return self.listStyle(InsetGroupedListStyle()) 				} else { 						return self 				} 		} } But they all fail with Function declares an opaque return type, but the return statements in its body do not have matching underlying types Removing the #if available and one of the options does work.
Jun ’20