Post

Replies

Boosts

Views

Activity

SwiftUI insists on re-creating view hiearchy on navbar clicks
I am building an app which displays a proprietary format document. The document, as well as the custom UIView, is designed for user interaction. I am using the navigation bar / toolbar to provide commands for interacting with the document (adding, removing objects, etc). However, on each click/tap on the toolbar, swiftUI is recreating the views. This is totally unnecessary and messes up all data. Note that there are no @State variables being changed, methods of the document (a pure swift class) are called directly in the action enclosure. How can I stop swiftui from doing this ?
1
0
386
Aug ’22
Obtaining a pointer to self for use with a C function
After having searched for the "correct" way of doing this, I came across this post : How do I get a pointer to self. Great, I thought, so I put in place the solution which was stated to work : func ptrToSelf() -> UnsafeMutableRawPointer { var mySelf = self return UnsafeMutableRawPointer(&mySelf) } And it works ! Super ! However, I am getting this warning : Initialization of 'UnsafeMutableRawPointer' results in a dangling pointer I looked again at the post and saw that Quinn had referenced another one ... but it is no longer available. So, my obvious question here - for it is worrying me - is this a real problem ? Is there another way of getting a pointer to self which is more 'secure' ?
0
0
289
Jun ’22
Creating a custom UIView for displaying a custom document
I have a private document format for which I need to be able to draw the contents into a custom view. I have seen that we can create a custom UIView and "plug" it into a SwiftUI app. However, I have not been able to find how to insert the view into a scrollview and correctly size it's height depending on the size of the document to be displayed. request a redraw/layout on document size changes In addition, I would need to know which functions should be overridden so that putting the view into a SwiftUI ScrollView will integrate correctly. This will represent a graphical document for which the existing SwiftUI/UIView objects are not suited. Where can I find the necessary information for doing this, please ?
0
0
324
Jun ’22
How to obtain the crc32 value for a given file?
I am needing to calculate the crc32 value for a file which my app will download from the apps server. This is to ensure that I have got the correct file (avoid middle man attacks). However, my searches on the web has revealed nothing that can be done from within swift. I am surprised as this would appear to be a basic need - even if other algorithms are being used as well. Can I be pointed in the right direction for this ?
0
0
365
Jun ’22
Integrating cryptography into a swift app
I am porting my Android app over to iOS and need to integrate encryption for communication with an existing server. I need to be able to use AES-CBC and RSA-ECB. My research has led me to the CommonCrypto library, but I have been stuck on this for days now, not finding how to integrate the library into my XCode project. I am using XCode version 12.2 (not sure what version of swift comes with that though). The methods I have tried to get CommonCrypto into the project are adding import CommonCrypto into the swift file, or adding #import <CommonCrypto/CommonCrypto.h> into the bridging header. Both of these makes XCode complain saying it cannot compile the Obective-C module. In addition, I have not been able to find documentation explaining the correct way of using the library. I need to : Generate public and private keys for AES Generate public and private keys for RSA Encrypt and decrypt with AES-CBC with PKCS5 padding Encrypt and decrypt with RSA-EBC with PKCS1 padding Please note that I cannot change the encryption standards used. Should I stick with CommonCrypto, go with OpenSSL, another fairly future proof solution ? I would really appreciate help and guidance with this, please. (Sorry, could not find any better tags)
7
0
3.5k
Jun ’22