I strongly hope there is a first-party solution for this, without having to use Google stuff in my apps and such.
Ummm...No. I believe currently Apple doesn't provide any ad solution inside apps.
To provide ads in your app you can use google's AdMob services. But you don't have to use AdMob, just search 'AdMob alternatives' and you will find other ad providers. Check if the ad provider allows you to set the ads to be child-safe (AdMob does provide this option).
Post
Replies
Boosts
Views
Activity
Hi there,
These red errors meaning that you did not follow the correct syntax form of the swift programming language.
From the screenshot I assume you want to create a map application but you don't have much experience programming with Swift. It would be better to start by learning the Swift programming language first, then you will find out why there would be so many error and how to correct them.
If you are not familiar with programming at all, a good staring point is the Swift Playground app that you can download from the App Store.
Cheers
Hi there,
The @State notation before the text property in ChildView is the reason why. An @State creates a new state while the result you are trying to achieve needs to let the content of the text depends on the parent view. So just remove the @State notation in ChildView and it will work.
You might be interested in these SwiftUI Essentials WWDC videos:
SwiftUI Essentials
Data Flow Through SwiftUI
Demystify SwiftUI
You can start with SwiftUI and integrate UIKit components later.
You can also start working with UIKit then integrate SwiftUI components later.
So I think it's perfectly fine to start using SwiftUI now for iOS platforms. It is certainly getting better and better each year and when you tried it you know it will be easier to use compared to UIKit. Besides you can always create wrappers for UIKit components to use them in SwiftUI. Why not just start with SwiftUI and see if you like it?
I've found the solution in Stack Overflow. It's because by default SwiftUI views with zero opacity doesn't have a content shape. Use .contentShape(Rectangle()) makes the view use the Rectangle content shape so it becomes tappable:
Color.clear
.contentShape(Rectangle())
.onTapGesture {
counter += 1
}