Skip to content

Cannot use enum 'DataBind||Anything' here; it is an SPI imported from 'RiveRuntime' #432

@teejayhh

Description

@teejayhh

Description

I am trying to build a RiveBuilder class which lets me load/cache Files and create rive objects. Unfortunately I am running into some issue with the experimental api


@_spi(RiveExperimental) import RiveRuntime
    ....
    public func build(
        _ animation: RiveAnimationFile,
        dataBind: DataBind = .auto,
        fit: Fit = .contain(alignment: .center)
    ) async throws -> Rive {
        let file = try await loadFile(for: animation)
        let artboard = try await file.createArtboard(animation.artboardName)
        return try await Rive(
            file: file,
            artboard: artboard,
            dataBind: dataBind,
            fit: fit
        )
    }

All classes of the runtime error with

Cannot use enum 'DataBind' here; it is an SPI imported from 'RiveRuntime'
Cannot use enum 'Fit' here; it is an SPI imported from 'RiveRuntime'
Cannot use class 'Rive' here; it is an SPI imported from 'RiveRuntime'
Cannot use class 'File' here; it is an SPI imported from 'RiveRuntime'

I have imported correctly and I am using - 6.17.0

Any ideas ?

Solution
I had the class declared as final.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions