Skip to content

Auto generated code compile error with example setup #99

Open
@CodingRac

Description

@CodingRac

I installed the latest version of ObjectBox using cocoapods. I'm using xcode 26 beta 2 and compiling for M1 ipad pro and getting a compile error with the most basic example setup: "Type 'Person' does not conform to protocol '__EntityRelatable'"

import ObjectBox

// objectbox: entity
class Person {
    var id: Id = 0
    var firstName: String = ""
    var lastName: String = ""
    
    init() {} // Used by ObjectBox
    
    init(id: Id = 0, firstName: String, lastName: String) {
        self.id = id
        self.firstName = firstName
        self.lastName = lastName
    }
}
// Generated using the ObjectBox Swift Generator — https://objectbox.io
// DO NOT EDIT

// swiftlint:disable all
import ObjectBox
import Foundation

// MARK: - Entity metadata

extension Person: ObjectBox.Entity {}

extension Person: ObjectBox.__EntityRelatable {
    internal typealias EntityType = Person

    internal var _id: EntityId<Person> {
        return EntityId<Person>(self.id.value)
    }
}

extension Person: ObjectBox.EntityInspectable {
    internal typealias EntityBindingType = PersonBinding

    /// Generated metadata used by ObjectBox to persist the entity.
    internal static var entityInfo = ObjectBox.EntityInfo(name: "Person", id: 2)

    internal static var entityBinding = EntityBindingType()

    fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws {
        let entityBuilder = try modelBuilder.entityBuilder(for: Person.self, id: 2, uid: 1890438448524192768)
        try entityBuilder.addProperty(name: "id", type: PropertyType.long, flags: [.id], id: 1, uid: 7490882468060812544)
        try entityBuilder.addProperty(name: "firstName", type: PropertyType.string, id: 2, uid: 7753594182974186496)
        try entityBuilder.addProperty(name: "lastName", type: PropertyType.string, id: 3, uid: 2295768579609292032)

        try entityBuilder.lastProperty(id: 3, uid: 2295768579609292032)
    }
}

Image

Metadata

Metadata

Labels

bugSomething isn't workingmore info requiredNeeds more info to become actionable. Auto-closed if no response.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions