Post

Replies

Boosts

Views

Activity

How do I make a pop-up menu in iOS?
What framework would I use to make one of those popup menus that I see when I long press a field when I look at a Contact in Contacts. The popup menu is black. It looks like a horizontal bar with items separated by a very think vertical white line between each item. When I press a field while viewing a Contact, the menu gives an option to Copy and another option for iPhone to Speak.
2
0
1.5k
Dec ’22
Anyone want a "guard catch" statement to be implemented in Swift?
Has anyone ever heard about any requests for swift to implement a "guard catch" statement? It would be like a do catch statement that allows code execution to continue like a guard statement does, and would provide an Error object to be used with a return statement or any of the key words a guard statement allows when the guard condition fails. It would look like this: guard do { . . . } catch { . . . return error }
1
0
731
Dec ’22
Has anyone figured out how to create a CNContainer in an iOS device?
Apple Documentation says that there is only one CNContainer in an iOS device of type local. Creating a container of type exchange requires using Exchange, and creating a container of type cardDAV requires a server also. Is there any way to create a container of type unassigned? I would need to do this programmatically in Swift to use in my iOS app. This question and the posts it mentions give no answer.
2
0
1.9k
Dec ’22
How do I turn off certain features on my iOS app when it's installed on a specific device?
I remember getting a message while running my iOS app on an iOS device that said I have to turn Developer mode on in my iOS device and I found the setting and turned on developer mode. I'm looking for that setting again so I can turn it off on iPhone I use, so that my app can check if Developer mode is on, and if it's not on, certain features are disabled, particularly one that deletes data on the device. That is intended to delete test data. I don't want actual data on my iPhone to be deleted. I need this precaution. When I looked at Developer Settings in Settings app on my iPhone 8 using iOS 15.6.1, there doesn't seem to be any way of turning off developer mode. Is there something I can check on my device that I can use to let my app know that I don't want certain features to be available on my app for that specific device?
1
0
1.1k
Oct ’22
How to make my iOS app appear in UICloudSharingController so that it could share a CKShare.url with my app to other users of my app?
What App Extensions and Entitlements or any other settings or anything else do I need to do in order to allow my app to use CloudKit sharing to share CKShare.url with other users of my app so that one user can share with another user by sending the URL to my app in addition to other apps such as Messages and Mail?
0
0
677
Oct ’22
How do I use UIActivityViewController to share text with other users of my iOS app?
I am using a Share Extension that shares a simple text, thus NSExtensionActivationSupportsText is in my Info.plist. How would I configure UIActivityViewController to enable my app to share test with other uses of my app? Which classses would I need to use? I actually need to pass a URL, more specifically a URL generated by CloudKit framework to use CKShare and UICloudSharingController, but for now I need to learn how to simply share test information.
0
0
717
Oct ’22
How do I share content from my iOS app using the standard iOS share sheet?
It looks like the Share Extension allows other "host" apps to share content with my "containing" app. How do I share content from my app with other apps using the standard iOS share sheet? I have found information on how to use UISheetPresentationController and UIActivityViewController. What is Apple's designated standard API to share content from my iOS app? I would think their designated way would show all the the apps that the share sheet can share with. Is UIActivityViewController the way that is most intended by Apple to do this?
0
0
625
Oct ’22
Is CKDatabase.save(_:completionHandler) really run synchronously?
CKDatabase save(_:completionHandler:) has a box that says the following below. Yet when I run the method, the completionHandler runs after the print statement after the call to the save method. I noticed the declaration of the method to be run synchronously has an escaping completionHandler. If the method is run synchronously, doesn't using an escaping completionHandler defeat the purpose of executing the method synchronously, or is the documentation wrong and the method is actually run asynchronously both ways? Concurrency Note You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func save(_ record: CKRecord) async throws -> CKRecord For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. Here is my essential code with the nonessentials taken out: print("*** 1 before self.privateCloudKitDatabase.save(record)") self.privateCloudKitDatabase.save(record) {       recordReturned, errorReturned in       print("*** 2 closure self.privateCloudKitDatabase.save(record)")     } print("*** 3 after self.privateCloudKitDatabase.save(record)") Here's the debug window: *** 1 before self.privateCloudKitDatabase.save(record) *** 3 after self.privateCloudKitDatabase.save(record) . . . (other print statements) *** 2 closure self.privateCloudKitDatabase.save(record)
1
0
773
Oct ’22
How do I use lldb with Playground?
I'm getting a runtime error in Playground that tells me to run an lldb command. I am not able to type anything in the debug area of Playground as I can in Xcode. How do I use lldb with Playground. Specifically, the error I'm getting is: error: Execution was interrupted, reason: shared-library-event. The process has been left at the point where it was interrupted, use "thread return "-x"" to return to the state before expression evaluation. I'm able to see some of the "stack trace", I think is what it is, when I click on the icon of an eye on the right side of the code editor in Playground, but it only shows a small portion it.
1
0
1.3k
Oct ’22
Why is code not stopping at breakpoints in playground in swift file in Sources folder?
I am using Playground, and I am able to set breakpoints in a file in the Source folder, but code execution doesn't stop at the breakpoints. I know the code runs to those points, because there are print statements that print into the debug area that are placed between those breakpoints. What should I do? Is there a setting that would fix this?
1
0
698
Oct ’22
How do I get the value of UITextField text instance property and update UITableView row whenever the user edits the UITextField text property?
0 How would I update a table view row as as a text field text changes? It is difficult to create a string from the arguments in textField(:shouldChangeCharactersIn:replacementString:) so that the string I create would be equal to the string value of the text property of the text field after the textField(:shouldChangeCharactersIn:replacementString:) occurs. Is there a way to use the UITextInput protocol of UITextField? I haven't found anything on stackoverflow about using the UITextInput protocol of UITextField except a question in 2012 using Objective-C that asks why he's getting a crash.
3
0
1.4k
Oct ’22