Post

Replies

Boosts

Views

Activity

Reply to Decoding dynamic json
You can use QuickType.io to get a set of structs for your data. I just used it and got: // let results = try? JSONDecoder().decode(Results.self, from: jsonData) import Foundation // MARK: - Results struct Results: Codable { let results: [Result] } // MARK: - Result struct Result: Codable { let id: Int let createdAt, updatedAt, email, name: String let attributes: Attributes enum CodingKeys: String, CodingKey { case id case createdAt = "created_at" case updatedAt = "updated_at" case email, name, attributes } } // MARK: - Attributes struct Attributes: Codable { let name: Name let anboolen: Bool let anNumber: Int let anString: String } // MARK: - Name struct Name: Codable { let firstname, lastname: String } You should set the items within attributes to be optional, so it will work however many of the fields are present.
Topic: App & System Services SubTopic: General Tags:
May ’24
Reply to Rejected due to having User Registration to use the App
I think they're saying that you should let people use the app without having to register. You have a free tier, so if the user isn't registered then they will be kept at the free tier level of service which might be ten requests total then nothing. You could change your app so it stops allowing requests once your free limit has been reached, but that won't stop an unregistered user deleting the app and reinstalling it, so you might have to think about putting in some annoying full-screen ads before an unregistered user can make a request. At least you'll make a bit of money. Obviously, you would never put an ad in the app for a registered user. So, simple overview: User downloads the app. User launches the app. User is presented with a screen to login to their account or use the free tier. You should explain what the free tier offers, and what its limits are. If they login, they can make requests at whatever level of service they've paid for. If they don't login, then the app shows a fullscreen ad, then makes the request. ...Repeat until they hit the free limit... Next time they attempt a request, you reject it and tell them they have to register to continue using the service. Alternatively, get back in touch with the App Review team and see that they suggest. Device fingerprinting is out of the question.
Topic: App & System Services SubTopic: General Tags:
May ’24
Reply to Looking For A Creative Solution To A Problem - Time Senstive
This sounds like more of a legal matter. What's in the contract between you and the other company? I wouldn't simply cut them off unless your contract states that you can. You need to discuss this with them, telling them that you're going to stop using their back-end services on a specific date (or within X days). Another option might be to reduce the number of requests that go through the old server, and ramp up the calls to the new server. So, you would code the app to know about both servers, and use the old server for 80% of the calls for the first week, then 70%, 60%... 0%, when all your calls would be to the new server. You should also code it so that if the old server isn't available it always uses the new server so there's no failure if the old developer gets miffed.
May ’24
Reply to xCode 15.4 keeps asking me for components installation
What's in the Platforms tab of the Settings? Since you're constantly being asked to install already-installed components, I'd suggest removing them from this tab then installing them once only from within the Platforms tab. If that works, you're golden. If it doesn't: Remove all platforms again. Launch Disk Utility (yes, Disk Utility). Unmount any images of the SDKs that are showing there. You might have to show all volumes rather than just disks. Delete and reinstall Xcode. Select which components you want to install from that selections dialog.
May ’24
Reply to Watch OS
These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding their own apps. These forums are NOT where Apple's actual developers chat about stuff. Your question is more of a product support one, so I'd suggest you ask it over at the Apple Support Forums. Thanks. What is the Watch actually asking you? It may be that you've put it into Sleep focus.
Topic: App & System Services SubTopic: Core OS Tags:
May ’24
Reply to Is it possible to change bundle id of Watch kit app?
I have a fully Swift & SwiftUI-based app with the following targets: Main app = com.abc.appname Watch app = com.abc.appname.watchkitapp So I'm not sure why your "Apps are not connected unless I changed it to com.x.watchkitapp -> com.x.watch". Are you sure you've only tried to change the one bundle id? Have a look through all your targets' Build Settings and make sure everything is in order there. Xcode's settings and how to get everything to link together is sometimes akin to magic. I had massive issues with IntentsExtensions until Apple moved to AppIntents.
Topic: App & System Services SubTopic: General Tags:
May ’24
Reply to Mapkit SwiftUI iOS17
The error is telling you that there is no such form of Map that matches what you've entered. If you remove showsUserLocation: true it works, because that form of Map() is valid. If you want to show the user's location you need to use UserAnnotation(), i.e.; Map(position: $mapPosition, interactionModes: .all) { UserAnnotation() // <<-- Use this ForEach(features) { feature in Marker(coordinate: feature.coordinate) { FeatureAnnotation(feature: feature) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’24
Reply to Why can't I get text to appear at top of view.
It looks like your Spacer() should be inside the VStack, after the Text. You're currently telling SwiftUI to display a background image, then on top of that (because of the ZStack), display Text inside a VStack, but your Text is the only thing in the VStack so it just sits there in the centre. Then you're saying have a Spacer(), but this is inside the ZStack so it isn't pushing the Text up, it's just layered on top of the VStack. The way to fix it is to put the Spacer() in the VStack. You can see this clearly if you change your Spacer() to something like: Rectangle() .fill(Color.green) .frame(width: 100, height: 50) Let's see what it does in the different formats: ZStack { VStack { Text("What would you like to do?") .font(.title) .fontWeight(.bold) } .padding() // -- Outside of the VStack, as you currently have it: Rectangle() .fill(Color.green) .frame(width: 100, height: 50) // Spacer() } So, here, your Spacer() (the Rectangle()) is where your current Spacer() is, and it produces this: Now, moving the Spacer/Rectangle inside the VStack: ZStack { VStack { Text("What would you like to do?") .font(.title) .fontWeight(.bold) // -- Inside the VStack: Rectangle() .fill(Color.green) .frame(width: 100, height: 50) // Spacer() } .padding() } And it looks like this: So, using a Spacer() inside the VStack does this:
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’24
Reply to Question about textfield
I'd be wary of comparing objects in that manner. I think maybe TextField has a tag property? You could set A's tag to 0, B's to 1 etc. then check in the function for the value of textfield's tag. Might work.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’24