potatotips #64でLTした内容です。 SwiftUIのViewで条件によってViewをだしわけたいことがたまにあるかと思います。 SwiftUIでこのように条件によってViewを出し分けるようなコードを書いてみます。 var body: some View { if imageName.isEmpty { return Text("no image") } else { return Image(imageName) } } そうするとこのようなコンパイルエラーになってしまいます。 ! Function declares an opaque return type, but the return statements in its body do not have matching underlying types なぜかというとbodyの戻り値の型がOpaque Result