How would I do that?
You don't, because Apple will not allow it.
(The app would not comply with the App Store terms, and would not be approved.)
5.3.3 Apps may not use in-app purchase to purchase credit or currency for use in conjunction with real money gaming of any kind.
Post
Replies
Boosts
Views
Activity
Two people have tried to help you, and you have criticised them both.
Do you want people to help you?
What font are you using in Xcode?
Good response.
I suggest you mark your post as the "correct" answer.
This will close the thread, and indicate that it contains useful information.
Core Data with SwiftUI
Create the Core Data container once when the app starts
Inject its managed object context into the environment
Perform fetch requests directly on there
NSManagedObject conforms to the ObservableObject protocol
which means we can bind any object to part of our user interface
There’s a managedObjectContext key in the environment
designed to store our active Core Data managed object context
We then inject that context into the initial content view.
There’s a @FetchRequest property wrapper
that uses the environment’s managed object context to perform fetch requests
You'll have to recreate your Task struct as an NSManagedObject, and it won't behave quite the same, so you'll have a bit of work to do.
Using a regular expression to validate an email address is doomed to failure.
To do this properly, use NSDataDetector, or NSPredicate.
There's a nice take on this here: https://www.swiftbysundell.com/articles/validating-email-addresses/
Paul Hegarty's cs193p course at Stanford is top notch.
2021, but well worth a look.
https://cs193p.sites.stanford.edu/
Your String init assumes that the data is encoded using UTF-8.
Could it be that in some cases, the cString is not encoded using UTF-8?
(You can specify the encoding to use, when creating your String.)
Perhaps you mean this?
func addDance(_ sentence: String) -> String {
return sentence + " and then we dance"
}
sampleData is an array of DailyScrum.
It is a "let" constant, it cannot be changed.
It is a computed property... it is computed at compile time.
No recommended frequency - that's not how it works.
You register for location updates, then your CLLocationManagerDelegate "didUpdateLocations" is called by the system, whenever the location has changed by a significant distance (which you can specify).
Well, that was an interesting one!
It's hard to understand why the original code is failing, but at least you have a workaround.
Thanks for accepting my answer.
Ah, this is interesting...
If I replace the coordinates with:
CLLocationCoordinate2D(latitude: 50.597186, longitude: 8.657226),
CLLocationCoordinate2D(latitude: 50.597186, longitude: 8.679199),
CLLocationCoordinate2D(latitude: 50.583236, longitude: 8.679199),
CLLocationCoordinate2D(latitude: 50.583236, longitude: 8.657226)
...it works!
Yes, that's a doozy.
I am seeing the problem in the Simulator, and on a real device.
I have simplified your code (using only the first polygon), in case anyone else wants to try it:
import MapKit
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var mapView: MKMapView!
override func viewDidLoad() {
super.viewDidLoad()
mapView.delegate = self
let coordinates: [CLLocationCoordinate2D] = [
CLLocationCoordinate2D(latitude: 50.59718623058702, longitude: 8.6572265625),
CLLocationCoordinate2D(latitude: 50.59718623058702, longitude: 8.67919921875),
CLLocationCoordinate2D(latitude: 50.58323661480589, longitude: 8.67919921875),
CLLocationCoordinate2D(latitude: 50.58323661480589, longitude: 8.6572265625)
]
let polygon = MKPolygon(coordinates: coordinates, count: coordinates.count)
mapView.addOverlay(polygon)
mapView.centerCoordinate = polygon.coordinate
mapView.region.span = MKCoordinateSpan(latitudeDelta: 0.1, longitudeDelta: 0.1)
}
}
extension ViewController: MKMapViewDelegate {
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
if let polygon = overlay as? MKPolygon {
let renderer = MKPolygonRenderer(polygon: polygon)
renderer.strokeColor = .black
renderer.lineWidth = 5
return renderer
}
return MKOverlayRenderer(overlay: overlay)
}
}
On zooming in, the polygon loses one of it's sides, then another one.
No, users can always disable notifications in Settings.
It is most likely caused by:
renderer.lineWidth = 0.7
Try...
renderer.lineWidth = 1
...and see if that fixes it.