Search results for

Swift 6

49,190 results found

Post

Replies

Boosts

Views

Activity

Reply to Screen layout positioning in Swift
something went wrong with formatting the code in your post, so it is a difficult to reproduce. I'm not sure what you're trying to get at here - you can wrap the two check boxes in an HStack, they will then appear side by side HStack { Toggle(isOn: $isCheckedOption900) { Text(9:00am) } .toggleStyle(CheckboxToggleStyle()) Toggle(isOn: $isCheckedOption930) { Text(9:30am) } } Please, when you post code, say for which platform (your code doesn't work on iOS). If you have check boxes for every half hour from 9am till 6:30pm, they're probably not going to fit across one screen anyway, if you don't want a fixed-size window, maybe you want to think about using some other container.
Topic: UI Frameworks SubTopic: SwiftUI
3d
Screen layout positioning in Swift
Hello everyone, I’m just trying to position these times and check boxes side by side as shown in the attachment. So far no matter what I try, it only lists. There are more fixed times for example 10:00am all the way to 6:30pm. The user picks the times that they are NOT available. This is a sample of the code below. The check boxes work fine, it’s just the screen layout I’m having issues with. Any advice will be appreciated. ..................................... import SwiftUI struct ContentView: View { @State private var wakeup = Date.now @State private var isCheckedOption900 = false @State private var isCheckedOption930 = false var body: some View { Text(Select unavailable Dates/Times) DatePicker(Please enter a date, selection: $wakeup) .labelsHidden() } Form{ Section(Enter Blockout times) { Toggle(isOn: $isCheckedOption900) { Text(9:00am) } .toggleStyle(CheckboxToggleStyle()) Toggle(isOn: $isCheckedOption930) { Text(9:30am) } .toggleStyle(CheckboxToggleStyle()) }
Topic: UI Frameworks SubTopic: SwiftUI
1
0
393
3d
Creating Swift Package with binaryTarget that has dependencies
How can you distribute an XCFramework via Swift Package Manager when it has dependencies on other Swift packages? We accomplished this with CocoaPods in order to distribute our closed source SDK that has dependencies, but need to migrate to SPM. Note none of the types from the dependencies are used as part of our module’s public interface - usage is purely internal. I’ve made a lot of progress following these steps for a simple example: Create Framework Project Create a new iOS Framework project in Xcode and name it WallpaperKit In the project settings select the target and verify in Build Settings that Build Libraries for Distribution is Yes then set Skip Install to No Create a new UIViewController subclass, name it WallpaperPreviewViewController, make it public, and add some functionality to it to show a UIImageView Add a new Package Dependency in the project settings, for this example we’ll use https://github.com/onevcat/Kingfisher, and specify exact version 8.5.0 Add internal import King
0
0
92
3d
Game Activity link works when app is running, but not on cold start
I’m testing Game Activities in my Unity project with the new Apple.GameKit 2025-beta1 plugin. When I go into Xcode- Debug → GameKit → Manage Game Progress → Leaderboards → and click the generated link: If my app is already running in the background, the link opens the app and my handler (Apple.GameKit.GKGameActivity.WantsToPlay += OnWantsToPlay;) fires as expected. I can read the activity and route the player to the right level. If the app is completely closed, clicking the same link launches the app, but my OnWantsToPlay listener is never invoked. The app just boots normally and the activity intent seems lost. I’ve tried to subscribe as early as possible (in Awake() of my bootstrap scene, also tested with RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]). Nothing works. Also, “Get Started with Game Center” video only demonstrates activation when the app already running, not a cold start from a Game Activity link. What am I missing? Environment Device/OS: iPhone on iOS 26.0 beta (G
0
0
49
3d
Xcode 26 beta, upgrading iOS beta
I'm currently running Xcode 26 beta 7; it comes with macOS 26 beta 6 and can download iOS 26 beta 6. I can compile and test my app on simulators, but to upload the app to TestFlight I need a version of the Platform support more recent than beta 6. How can I download beta 9? In Settings -> Components I see only beta 6.
0
0
66
3d
Error Message when running C++ program (with SFML) in Xcode.
Error Message: dyld[11081]: Library not loaded: @rpath/sfml-system. framework/Versions/2.5.1/sfml-system Referenced from: /Users/………../Library/Developer/Xcode/DerivedData Computer_Simulation_Part_A_Stage_2-gflpuzzcrbxlhsgqypwfzyighzkj/Build/Products/Debug/Terminal.app/Contents/MacOS/Terminal Reason: tried: ‘/Users/…………./ Library/Developer/Xcode/DerivedData/Computer_Simulation_Part_A_Stage_2-gflpuzzerbxIhsgqypwfzyighzkj/Build/Products/Debug/sfm1-system.framework/Versions/2.5.1/sfmI-system' (no such file), ‘/Users/…………/Library/Developer/Xcode/DerivedData/Computer_Simulation_Part_A_Stage_2-gflpuzzerbx1hsgqypwfzyighzkj/Build/Products/Debug/Terminal.app/Contents/MacOS/../Frameworks/sfmI-system. framework/Versions/2.5.1/sfmI-system' (no such file), ‘/Users/………./Library/Developer/Xcode/DerivedData/Computer_Simulation_Part_A_Stage_2-gfIpuzzcrbxIhsgaypwfzyighzkj/Build/Products/Debug/Terminal.app/Contents/MacOS/../Frameworks/sfmI-system. framework/Versions/2.5.1/sfmI-system' (no such file) Message from debugger: Termin
1
0
98
4d
macOS 26: retain cycle detected when navigation link label contains a Swift Chart
I'm running into an issue where my application will hang when switching tabs. The issue only seems to occur when I include a Swift Chart in a navigation label. The application does not hang If I replace the chart with a text field. This appears to only hang when running on macOS 26. When running on iOS (simulator) or visionOS (simulator, on-device) I do not observe a hang. The same code does not hang on macOS 15. Has any one seen this behavior? The use case is that my root view is a TabView where the first tab is a summary of events that have occurred. This summary is embedded in a NavigationStack and has a graph of events over the last week. I want the user to be able to click that graph to get additional information regarding the events (ie: a detail page or break down of events). Initially, the summary view loads fine and displays appropriately. However, when I switch to a different tab, the application will hang when I switch back to the summary view tab. In Xcode I see the following messages ===
0
0
125
4d
Validating Mac App Store purchase with StoreKit
For years I've been using Receigen for receipt verification for the Mac App Store build of my application. However, with the deprecation of exit code 173, I am moving to StoreKit-based verification and have a couple of questions. I have followed the instructions from https://developer.apple.com/documentation/storekit/apptransaction/shared and have something like this (simplified): Swift: @objc class ValidateReceipt: NSObject { @objc func validate() async -> Bool { do { let verificationResult = try await AppTransaction.shared switch verificationResult { case .verified(_ /*let appTransaction*/): // StoreKit verified that the user purchased this app and // the properties in the AppTransaction instance return true; default: // The app transaction didn't pass StoreKit's verification return false; } } catch { // Handle errors return false; } } } Objective-C: ValidateReceipt *validateReceipt = [[ValidateReceipt alloc] init]; [validateReceipt validateWithCompletionHandler:^(BOOL result) { if (result) { //
1
0
179
4d
Reply to Using raise in GCD can cause timing issues with the signal mechanism.
Sorry I didn’t reply sooner. I was notified of your earlier posts )-: [quote='850943022, SilverFruity, /thread/794589?answerId=850943022#850943022, /profile/SilverFruity'] calling raise to throw SIGABRT does not block the thread under GCD. [/quote] By “under GCD” I presume you mean “when using a Dispatch signal event source to handle the signal”. If so, then, yes, that’s expected. Dispatch signal event sources are very much like kqueues, in that they are delivered asynchronously. Thus if you raise a signal by calling raise (or kill with your own pid) then the thread calling raise may well return before the signal is delivered to the queue. If you’re building your own crash reporter — which, as I noted above, is something I specifically discourage — and you choose to implement in-process crash reporting via signals — again, not something I recommend — then you have to use a signal handler rather than a Dispatch signal event source. [quote='851087022, SilverFruity, /thread/794589?answerId=851087022#851087022, /
4d
Reply to Drag-and-Drop from macOS Safari to NSItemProvider fails due to URL not being a file:// URL
I also try to be a good app, and provide asynchronous support. I think that's your problem. It's too difficult to keep up with that. Your asynchronous code is already deprecated and disavowed. First of all, make sure you try using the ClipboardViewer tool. I think it's in Xcode's AdditionalTools as a separate download. I know you're dealing with Drag and Drop, which is not quite the same, but it may be enlightening as most people implement Copy and Paste with the same data. I've never tried dragging from Safari, but I certainly never seen any TIFF conversions. I even support data types that the system doesn't, so there's no way it ever could convert it. Again, I think you're trying too hard. Instead of itemProvider.loadInPlaceFileRepresentation, try just loadItem. That should give you the actual URL. You might run into concurrency problems. I seem to have encountered that myself with these APIs. Unfortunately, there's no easy solution. You definitely don't want to try those old dispatch queues, at least not i
Topic: UI Frameworks SubTopic: AppKit Tags:
5d
Reply to NWConnection: how to recover data connection after RF cellular data connection loss
[quote='856588022, jumbopilot, /thread/798431?answerId=856588022#856588022, /profile/jumbopilot'] But the connection using the same NWConnection instance (self.connection) does not succeed. [/quote] I’m actually a bit confused here, because your code uses two different syntaxes to refer to the connection. With reference to your most recent snippet, line 1 is this: self.connection.cancel() which uses self.connection and line 6 is this: connection = NWConnection(…) which just uses connection. I believe that these are referencing the same thing, that is, the connection property of the enclosing class. However, it’s hard to be 100% certain without seeing more context. Stilly, I can explain some basics… NWConnection is a class, so self.connection is a reference to that class. So, when talking about “the same connection” you have to distinguish between an object reference and the object itself. Any given NWConnection object has a one way state flow. It starts in the .setup state and ends in either .failed(
5d
StoreKit2 staff in static library that is included into CPP project. How?
Hello! My application written with CPP and using StoreKit2 functionality based on bridging CPP-ObjectiveCPP-Swift. The question is in correct project properties for adding this library to application. Configuring library by attaching project.entitlement file (within in-app purchase key) to the library project. Question is how to add library to the application correctly: Is there requirements to write another one entitlement for Application and switch on 'in-app purchase' in application too or it's enough to add it only to the library? Is there any examples of using StoreKit2 in libraries and attaching it to the projects? Is there any requirements for configuring library within StoreKit2 if it's going to be reused in different applications?
0
0
80
5d
The bottom tab bar appears after using the keypad in OS26.
hi Testing on OS26 Public Beta 6. In Safari, if you enter x homepage and scroll, the tab bar sticks to the bottom and moves. Make the keyboard appear in the search window When scrolling down on the Safari homepage again, the issue of not being able to stick to the bottom appears. Is it because the liquid glass UI was applied this time? and safari bug? Please let me know if I'm missing anything
Topic: Safari & Web SubTopic: General
2
0
752
5d
GKLeaderboard.LoadLeaderboards() return empty when testing on Xcode with local gamekit file (Unity)
var allLeaderboards = await GKLeaderboard.LoadLeaderboards(); Log(allLeaderboards.Count); // returns 0 What am I missing?? What doesn’t work: await GKGameActivityDefinition.LoadGameActivityDefinitions() → count = 0 await GKLeaderboard.LoadLeaderboards() (no args) → 0 leaderboards await GKLeaderboard.LoadLeaderboards(MY ID) → returns 0 GkGameActivity.SetScoreOnLeaderboard(Leaderboard, score, context); returns an error since my Leaderboard is null. Activities and leaderboards are defined in GameCenterResources.gamekit in Xcode. Achievements that I add locally in the .gamekit file do not appear at runtime either; only ASC live ones show. ** What works:** xcode- debug- Gamekit- Manage Game progress- I can submit new scores with the plus button and see the notification on my device. await GKLocalPlayer.Authenticate() succeeds. await GKAchievement.LoadAchievements() returns the list of achievements configured in App Store Connect- but not any new local achievements created in Xcode in GameCenterResources.gamekit En
2
0
657
5d