Post

Replies

Boosts

Views

Activity

Reply to SwiftUI Inspector ideal width
In SwiftUI, the inspectorColumnWidth modifier is meant to control the width of an inspector column within a TableView. The ideal parameter of this modifier should set the initial width of the inspector column, and the system should remember the user-adjusted width for subsequent launches. However, in the beta version of SwiftUI you're using, it seems that the ideal width might not be respected on initial launch. Workarounds: While waiting for potential updates or bug fixes from Apple, here are a few workarounds you can consider to achieve your desired behavior: Set Minimum Width to Ideal Width: Since you want to guarantee the initial width while allowing users to reduce the width, you can set the minimum width to the same value as the ideal width. This way, users won't be able to resize the inspector column to a width smaller than the ideal width. This could be a suitable approach if you're okay with users having a fixed minimum width of 550. TableView() .inspector(isPresented: $state.presented) { InspectorFormView(selection: model[state.selection]) .inspectorColumnWidth(min: 550, ideal: 550, max: 600) } Use a Different Layout: Depending on the complexity of your interface, you might consider alternative layouts that don't rely heavily on the inspector column width. This could involve rethinking the arrangement of your UI components or using different SwiftUI layout components that provide more flexible ways to manage widths.
Aug ’23
Reply to Airplane mode on watchOS
WatchOS does not provide a public API that allows you to directly control the airplane mode settings programmatically using Swift. However, you can use the WCSession framework to communicate between an Apple Watch and a paired iPhone app. This framework might indirectly help you determine if the iPhone is in airplane mode, but you won't be able to directly toggle the airplane mode state. Here's how you might use WCSession to determine if the iPhone is in airplane mode: Set up the WCSession in your WatchKit extension: import WatchConnectivity class InterfaceController: WKInterfaceController, WCSessionDelegate { override func awake(withContext context: Any?) { super.awake(withContext: context) if WCSession.default.isReachable { WCSession.default.delegate = self WCSession.default.activate() } } // WCSessionDelegate methods... } On the iOS side (the iPhone app), implement the corresponding delegate method to handle the message and provide the airplane mode status: import WatchConnectivity class ViewController: UIViewController, WCSessionDelegate { override func viewDidLoad() { super.viewDidLoad() if WCSession.isSupported() { let session = WCSession.default session.delegate = self session.activate() } } // WCSessionDelegate methods... func session(_ session: WCSession, didReceiveMessage message: [String : Any]) { if let airplaneModeStatus = message["airplaneModeStatus"] as? Bool { if airplaneModeStatus { print("iPhone is in airplane mode.") } else { print("iPhone is not in airplane mode.") } } } } In your watchOS code, you can send a message to the iPhone app to request the airplane mode status: func requestAirplaneModeStatus() { if WCSession.default.isReachable { let message = ["requestAirplaneMode": true] WCSession.default.sendMessage(message, replyHandler: { response in // Handle the response from the iPhone app }, errorHandler: { error in // Handle any errors }) } } Remember that this approach doesn't directly toggle airplane mode but rather communicates the status between the watchOS app and the paired iPhone app.
Aug ’23
Reply to Help Witch subscription Upgrade/downgrade tests in sandbox
Your approach to testing subscription upgrade/downgrade in the sandbox environment seems reasonable, but there are a few things you should consider and potentially adjust to ensure a smooth testing process. Test Durations: When testing subscription upgrades/downgrades, you might want to consider using shorter durations for each subscription tier in the sandbox environment. This will allow you to test the functionality more quickly and iterate through different scenarios efficiently. Test All Scenarios: Apart from testing the upgrade from 1 month to 3 months and downgrade back to 1 month, it's also important to test all possible scenarios, such as upgrading from 1 month to 12 months and downgrading from 12 months to 3 months or 1 month. This will ensure that your app handles all potential subscription changes gracefully. Wait Time: You mentioned waiting for 5 minutes before opening the app again. The subscription status might not get updated instantly, so it's a good practice to allow some additional time before checking the subscription status again. You can wait for a longer duration to be more certain that the subscription status has been updated. Verify Receipts: Make sure that you are correctly verifying the subscription receipts on the server-side to ensure that the subscriptions are active and valid during the testing process. Test on Different Devices: Test your subscription upgrade/downgrade flow on various iOS devices to check for any device-specific issues that might arise. Unity IAP Sandbox Testing: Double-check that you've set up Unity IAP correctly to work with the iOS sandbox environment. Ensure that the Unity IAP settings are correctly configured for the different subscription durations. Review Error Logs: If there's an error message shown during testing, make sure to check the error logs both in Unity and Xcode to identify the root cause of the issue. Reset Sandbox Account: If you encounter any unexpected behavior, you can try resetting the sandbox account on the device to start the testing process from scratch.
Aug ’23
Reply to Framework compatible issue
The error message you received indicates that the version of the "RFIDBleFramework" you have imported into your Xcode project was built using Swift 5.7.2, while your Xcode compiler is also Swift 5.7.2. However, it seems that the build toolchain (the compiler and related tools) used to build the framework is not exactly matching the one in your Xcode installation. Swift versions typically consist of three parts: major, minor, and patch versions. In this case, both the SDK (framework) and your Xcode are using the same Swift version 5.7.2, which means they should be compatible. However, the error message mentions that the specific Swift versions used to build the SDK and the Xcode compiler are slightly different: The SDK (RFIDBleFramework) was built with 'Apple Swift version 5.7.2 (swift-5.7.2-RELEASE)'. The Xcode compiler you have is 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)'. The part in parentheses indicates the exact build version of Swift. In a perfect world, it shouldn't matter, and minor differences like these shouldn't cause compatibility issues. However, in some cases, small differences can lead to issues due to specific changes or updates made in the compiler. To resolve this issue, you can try the following steps: Check if there are any updates available for Xcode. Sometimes, updating Xcode to the latest version can fix compatibility issues. If an update is not available, you can try reaching out to the vendor who provided the "RFIDBleFramework" and inquire if they have a version of the framework that was specifically built using the same Swift compiler version as your Xcode (swiftlang-5.7.2.135.5 clang-1400.0.29.51). Double-check that you imported the framework correctly into your Xcode project. Ensure that you followed the vendor's instructions for integration. If you have access to the source code of the framework, you might consider trying to build it using your Xcode and the same toolchain as your project. This way, you can ensure that the framework is built with the exact same Swift compiler version as your project.
Aug ’23
Reply to Cannot find ContentVIew() in scope
The error is occurring because you have nested your ContentView struct within the MyPyType struct, which is causing the ContentView to be scoped inside MyPyType and not at the top level. To fix the scoping error, you need to move the ContentView struct to the top level, outside of MyPyType. Here's the modified code: protocol runPyAndSendRequestRunnable { func runPyServer() -> String func sendRequest(inputText: String, completion: @escaping (String) -> Void) } func runPyServer() -> String { print("server run") return "server run" } func sendRequest() -> String { print("request sent") return "request sent" } struct MyPyType: runPyAndSendRequestRunnable { func runPyServer() -> String { return "server started" } func sendRequest(inputText: String, completion: @escaping (String) -> Void) { let userInput = inputText guard let url = URL(string: "http://localhost:8080/MacGPT") else { completion("Error: failed to obtain url") return } } } struct ContentView: View { var viewController: runPyAndSendRequestRunnable? = MyPyType() @State private var text: String = "" @State private var filePath = "" @State private var inputText = "" var body: some View { makeContent() .onAppear { NSApp.mainWindow?.makeFirstResponder(NSApp.mainWindow?.contentView) } } // ... rest of the code ... struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } } Now, the ContentView struct is at the top level, and the scoping error should be resolved. Make sure that your ContentView.swift file only contains the ContentView struct, and you should be good to go.
Aug ’23
Reply to Issue after turning on developer mode on apple watch
I'm sorry to hear that you're experiencing issues with pairing your second Apple Watch in developer mode. There could be several reasons for this problem. Let's go through some troubleshooting steps to try and resolve the issue: Check Compatibility: Ensure that both of your Apple Watches and your iPhone are compatible with the developer mode you're trying to activate. Check for any iOS updates for your iPhone and watchOS updates for your watches to make sure you have the latest software. Restart Everything: Start by restarting your iPhone and both of your Apple Watches. Sometimes, a simple restart can resolve connectivity issues. Reset Network Settings: On your iPhone, go to Settings > General > Reset > Reset Network Settings. This action will remove all network settings, including Wi-Fi and Bluetooth connections, and could potentially fix any connectivity problems. Check Bluetooth: Make sure that Bluetooth is turned on both your iPhone and your second Apple Watch. Sometimes, disabling and re-enabling Bluetooth can help establish a stable connection. Forget the Watch: On your iPhone, go to Settings > Bluetooth, find the entry for your second Apple Watch, and tap on the "i" icon next to it. Choose "Forget This Device" and confirm. Then, try pairing your watch again from scratch. Reset the Watch: If the issue persists, you can try resetting your second Apple Watch to its factory settings. This will erase all content and settings, so make sure you have a backup if needed. To reset your watch, go to Settings > General > Reset > Erase All Content and Settings. Update Developer Settings: If the developer mode on your second Apple Watch is causing the issue, you can try turning off developer mode temporarily, pairing the watch again, and then enabling developer mode once it's successfully paired. Remember to back up your data before performing any significant reset or change in settings to avoid data loss. I hope these steps help you resolve the problem and get your second Apple Watch paired successfully.
Aug ’23