plaid / plaid-link-ios

Plaid Link iOS SDK
https://plaid.com/docs/link/ios
MIT License
133 stars 88 forks source link

Xcode 14 Update: UIViewRepresentable must be a value type #21

Closed memamdie closed 1 year ago

memamdie commented 1 year ago

Bug Description: There is currently a runtime error in the LinkDemo-Swift-SwiftUI app target

Context: As of Xcode 14, any object that inherits UIViewRepresentable must be a value type. This does not generate a compiler error but when the app is run, it generates a runtime error. To resolve this runtime error I changed the class to a struct and added the @State binding to the handler property. The binding was necessary because otherwise the struct was mutating itself on L90. I chose to add the state binding rather than refactor this because it was minimally invasive, an acceptable SwiftUI pattern which is the purpose of this class, and the proper SwiftUI pattern for this use case, but I am open to making a different change.

Steps to reproduce:

  1. Download the Latest Xcode
  2. git clone https://github.com/plaid/plaid-link-ios.git
  3. open plaid-link-ios/LinkDemo.xcworkspace
  4. Select LinkDemo-Swift-SwiftUI as the target
  5. Build and Run
  6. Tap Open Plaid Link
  7. Observe runtime error
Before After
Plaid Before Plaid After
LeoXiao-cloud commented 1 year ago

Hi @memamdie, I am integrating LinkKit sdk, but because my project has a multi-layer structure: I created a static library of my own under the same workspace, included LinkKit in the static library, and then I links the static library to my app Target. When it runs on the iOS real device, it always crashes and reports image not found(Library not loaded: @rpath/LinkKit.framework/LinkKit). Can you help with this issue? Thank you The following is crash logs

dtroupe-plaid commented 1 year ago

@memamdie Thank you for flagging this. The most recent update to our SDK resolves this issue so I am going to close this PR.