Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objective-C provided getter does not match requirement's selector #143

Open
santanu4ver opened this issue Nov 2, 2016 · 1 comment
Open

Comments

@santanu4ver
Copy link

I'm having trouble converting my old source to Swift 3.0 in following area. I've this following usage which was working prior to the version 3.

    extension NewManPhoto: FICEntity
    {
        internal var UUID: String!
        {
            if _UUID == nil
            {
                // MD5 hashing is expensive enough that we only want to do it once
                let imageName: String = sourceImageURL.lastPathComponent
                let UUIDBytes: CFUUIDBytes = FICUUIDBytesFromMD5HashOfString(imageName)
                _UUID = FICStringWithUUIDBytes(UUIDBytes)
            }
            
            return _UUID;
        }
    }

New XCode starts giving me following error:
'UUID' has been renamed to 'uuid'

But when I looked inside the FICEntity file I noticed it had 'UUID' only:
*@Property (nonatomic, copy, readonly) NSString UUID;

Anyway, after accepting Xcode's auto-fix suggestion it became small-case, but pops another error:
Objective-C method 'uuid' provided by getter for 'uuid' does not match the requirement's selector ('UUID')

The code became something like this:

    internal var uuid: String!
        @objc(UUID) {

But beside it fixed, XCode erupt same error again to the line Objective-C method 'uuid' provided by getter for 'uuid' does not match the requirement's selector ('UUID') and the problem continues until the source became looks ugly and non-fixable.

Can you help how to resolve this situation?

@santanu4ver
Copy link
Author

santanu4ver commented Nov 8, 2016

I'm not sure if this the right way to overcome the said problem, but following syntax seems accepted by XCode; can you give your suggestion if this should work (I yet to fix other errors so unable to run the app at this moment to test):

@objc(UUID) internal var uuid: String!
    {
        if _UUID == nil
        {
            // MD5 hashing is expensive enough that we only want to do it once
            let imageName: String = sourceImageURL.lastPathComponent
            let UUIDBytes: CFUUIDBytes = FICUUIDBytesFromMD5HashOfString(imageName)
            _UUID = FICStringWithUUIDBytes(UUIDBytes)
        }

        return _UUID;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant