Skip to content
This repository has been archived by the owner on Feb 28, 2020. It is now read-only.

Migrating 5.2 to 6.0.1 #183

Open
JakubLares opened this issue Sep 30, 2019 · 1 comment
Open

Migrating 5.2 to 6.0.1 #183

JakubLares opened this issue Sep 30, 2019 · 1 comment

Comments

@JakubLares
Copy link

Hello, I am trying to migrate our project from version 5.2 to 6.0.1 and I am encountering some problems. Below is current code

import AlecrimCoreData
import CoreData
import CoreLocation

open class AbstractCoordinateCD: NSManagedObject {

    @NSManaged open var latitude: CLLocationDegrees
    @NSManaged open var longitude: CLLocationDegrees
}

// MARK: - AbstractCoordinateCD query attributes
extension AbstractCoordinateCD {

    static let latitude = AlecrimCoreData.Attribute<CLLocationDegrees>("latitude")
    static let longitude = AlecrimCoreData.Attribute<CLLocationDegrees>("longitude")
}

// MARK: - AttributeProtocol extensions
extension AlecrimCoreData.AttributeProtocol where Self.ValueType: AbstractCoordinateCD {

    var latitude: AlecrimCoreData.Attribute<CLLocationDegrees> { return AlecrimCoreData.Attribute<CLLocationDegrees>("latitude", self) }
    var longitude: AlecrimCoreData.Attribute<CLLocationDegrees> { return AlecrimCoreData.Attribute<CLLocationDegrees>("longitude", self) }
}

extension AlecrimCoreData.TableProtocol where Self.Element: AbstractCoordinateCD {

    func create(_ coordinate: CLLocationCoordinate2D) -> Self.Element {
        let retValue = create()
        retValue.latitude = coordinate.latitude
        retValue.longitude = coordinate.longitude
        return retValue
    }
}

extension AbstractCoordinateCD {

    var coordinate: CLLocationCoordinate2D {
        return CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
    }
}

In version 6.0.1 there is no AlecrimCoreData.Attribute, AlecrimCoreData.AttributeProtocol, AlecrimCoreData.TableProtocol ... maybe I am blind, but I don't find any alternatives in 6.0.1 version.
Can somebody help me please?

@vmartinelli
Copy link
Member

vmartinelli commented Sep 30, 2019

Hello.

Version 6 had breaking changes.

As in README: "In version 6 the framework was rewritten from scratch. AlecrimCoreData now uses key paths and it does not rely on generated (or written) custom attributes anymore. Also the ACDGen utility is no more. If your code depends on this, please use the previous versions."

I would like to resume library support, but for professional and personal reasons, it's just not been possible. If anyone else can help with this issue (and others), it would be nice.

Thank you.

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

No branches or pull requests

2 participants