Aws-sdk-ios: Support Swift 4/4.1 for API Gateway Generated SDK

Created on 1 May 2018  路  16Comments  路  Source: aws-amplify/aws-sdk-ios

To help us solve your problem better, please answer the following list of questions.

  • What service are you using?
    API Gateway.

  • In what version of SDK are you facing the problem?
    2.6.14.

  • Is the issue limited to Simulators / Actual Devices?
    Both.

  • Can your problem be resolved if you bump to a higher version of SDK?
    No actually.

  • Is this problem related to specific iOS version?
    Doesn't seem to be.

  • How are you consuming the SDK? CocoaPods / Carthage / Prebuilt frameworks?
    Carthage.

  • Can you give us steps to reproduce with a minimal, complete, and verifiable example? Please include any specific network conditions that might be required to reproduce the problem.
    It's the same issue as this one. The developer who filed that issue closed it because of the workaround discussed in the comments but the generated SDK remains broken (see comment).

api gateway feature request

Most helpful comment

Hello @rainypixels

Currently the generated code is for Swift 3.2. To make it work with Swift 4/ Swift 4.1 you will have to mark the members of your model class with @objc / @objcmembers as specified here.

I will mark this as an enhancement and update once we have support for Swift 4+

Thanks,
Rohan

All 16 comments

Hello @rainypixels

Currently the generated code is for Swift 3.2. To make it work with Swift 4/ Swift 4.1 you will have to mark the members of your model class with @objc / @objcmembers as specified here.

I will mark this as an enhancement and update once we have support for Swift 4+

Thanks,
Rohan

Thanks, @rohandubal! Do you have a rough ETA for when Swift 4/4.1 support is coming?

I currently do not have a timeline/ ETA for this. I will try to get some information from the team and keep this Issue updated.

Thanks @rohandubal.

Workaround from @rohandubal works, but I had to make one other change to make it work:

  1. Go to AWSMTLJSONAdapter.m file.
  2. Comment out line 150 to 153. It should look like:
        if (![propertyKeys containsObject:mappedPropertyKey]) {
            NSAssert(NO, @"%@ is not a property of %@.", mappedPropertyKey, modelClass);
            return nil;
        }

There's a problem with this validation, could be that it's checking the string object and not the string value.

Also hitting this issue with Swift 4. Any update on when the generated SDK will be fixed?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

Any update on this?

This really needs to be fixed. I can't tell you how annoying it is to have to modify my swift classes to add @objc to all the properties EVERY TIME the SDK is regenerated.

This isn't even a feature request - the generated SDKs just don't work out of the box.

+1

+1 Please let us know if you have any ETA on this since it's been 4 months from original response, and we have been continually have to investigate the issues caused by not having @objcMembers.

Most of developers will be using Swift 4 and up, so I'm not sure why Swift 4 is not supported yet.

+1 Really no news on this yet?

Sorry for the delay on this folks. We're preparing a fix to add @objcMembers to generated model classes, which should fix this issue. I don't have an ETA just now, but I'll update this thread when it's deployed.

This has been deployed to production. Generated SDKs now have @objcMembers annotations on model classes.

To be clear, this is a change on the AWS API Gateway service, not the SDK. That means that you will need to re-generate your SDK.

Please let us know if you have any problems.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

victorleungtw picture victorleungtw  路  4Comments

minhthuc251 picture minhthuc251  路  4Comments

pawlowskialex picture pawlowskialex  路  4Comments

cornr picture cornr  路  4Comments

premiumbosslimited picture premiumbosslimited  路  3Comments