Post

Replies

Boosts

Views

Activity

Reply to Swift/objC combined with Swift/C++ interop
I'm hoping that I can wrap a C++ std::function in some sort of opaque wrapper and pass that to swift, or something. Here that is, if anyone cares: // swiftcompat_voidfunc.hh #include <concepts> // swiftcompat_voidfunc is like a std::function<void(void)>, but it can be used with // Swift/C++ interop. // In Swift, arange for this header to be visible to Swift (i.e. include it from your // bridging header) and declare parameters and variables of type swiftcompat_voidfunc. // They have value semantics. Invoke the function using (). // In C++, include the other header, swiftcompat_voidfunc_cpp.hh. Construct swiftcompat_voidfunc // objects, passing the invokable (e.g. a lambda) to store. Pass these objects (by value) to // Swift APIs. // The issues that we need to address to make this work are: // - We can't pass std::function<> to Swift. // - We can't call a Swift closure type from C++. // - (We can pass objC blocks to Swift using Swift/objC interop, but we don't want to do that.) // - We can't expose std::unique_ptr<> in the bridged code (hence a raw pointer pimpl). // - The type needs to be copyable, not just moveable. // If anything changes in Swift/C++ interop that changes those assumptions, we may not need this. class swiftcompat_voidfunc { struct Impl; Impl* pimpl; public: swiftcompat_voidfunc(std::invocable<> auto cbk); ~swiftcompat_voidfunc(); swiftcompat_voidfunc(const swiftcompat_voidfunc& other); swiftcompat_voidfunc& operator=(const swiftcompat_voidfunc& other); void operator()(); }; // swiftcompat_voidfunc_cpp.hh #include "swiftcompat_voidfunc.hh" #include <functional> // See comments in swiftcompat_voidfunc.hh. // Include this file from C++ code. struct swiftcompat_voidfunc::Impl { std::function<void(void)> fn; }; swiftcompat_voidfunc::swiftcompat_voidfunc(std::invocable<> auto fn): pimpl(new Impl(fn)) {} // swiftcompat_voidfunc.cc #include "swiftcompat_voidfunc_cpp.hh" swiftcompat_voidfunc::~swiftcompat_voidfunc() { delete pimpl; } swiftcompat_voidfunc::swiftcompat_voidfunc(const swiftcompat_voidfunc& other): pimpl(new Impl(*other.pimpl)) {} swiftcompat_voidfunc& swiftcompat_voidfunc::operator=(const swiftcompat_voidfunc& other) { delete pimpl; pimpl = new Impl(*other.pimpl); return *this; } void swiftcompat_voidfunc::operator()() { pimpl->fn(); }
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’25
Reply to Appstore Connect Data Collection - Longer than Necessary
What does the point "longer than necessary" refer to? "Collection" requires two things: You need to transmit the data off the device, i.e. to your server. Your server needs to store the data for "longer than necessary to service the request". So if your server communication is a simple request/response system with no persistent state on the server side, then the server must not remember the content of the request after the response has been sent. For example, you're not allowed to log the requests (unless suitably anonymised). If you do require persistent state on the server side then you need to take care to not store more information than is actually necessary to deliver the functionality, and you must delete it once it is no longer needed. This could get complicated. Tell us more about your app's architecture?
Jan ’25
Reply to IOS App
If I understand correctly, what you've shown in the screenshot is not the "purpose string", it's the "App Privacy" information. These are two different things. The "purpose string" is something that you enter in Xcode, and is a text field where you can enter any text you like. The "privacy information" is entered in the App Store Connect web interface and is limited to selecting between various options. Please show us what you have entered as the location purpose string in Xcode, and then we can perhaps comment on it. In my experience, once App Review have decided that they don't like what you've written for a purpose string, it's not sufficient to make minor changes; you need to write something verbose that comprehensively covers everything that they want. In particular, they may require that you "give an example" as well as an abstract description.
Jan ’25
Reply to Email from app_notification@apple.com - Phishing?
Received a similar email, has anyone confirmed wether this is a legit email from Apple ? If you post the complete headers from the email you received, someone will be able to confirm whether it's genuine. Otherwise, you should definitely assume that it is genuine. Why do you doubt it? Apple terminate many thousands of developer accounts in this way each year. Happy New Year!
Jan ’25
Reply to StoreKitSubscriptionView presents an unfriendly message when network is unavailable
That's interesting, I just turned off WiFi in order to test this and I get a sensible message: "The internet connection appears to be offline. Something went wrong. Please try again". That's not what I was getting before, which was when WiFi was turned on but the network was unavailable in some way. (I note that this doesn't give any clue that it is related to the subscription, which is not ideal.)
Topic: App & System Services SubTopic: StoreKit Tags:
Dec ’24
Reply to Sync IOS cursor to app cursor.
My app controls the cursor within its text area. What exactly are you doing? UIKit or SwiftUI? Is your "text area" a custom view or a UITextField? There are various text input related protocols and interactions that you can use, including UITextInput, UITextSelectionDisplayInteraction, UITextInteraction, UIStandardTextCursorView etc. It may be that you need to work at a slightly lower level.
Dec ’24