Swift Ambiguous type name

Viewed 54
import UIKit
import Foundation
import CollectionViewPagingLayout

public extension SnapshotTransformViewOptions {
    enum Layout: String, CaseIterable {
        case grid
        case space
        case chess
        case tiles
        case lines
        case bars
        case puzzle
        case fade
    }

    static func layout(_ layout: Layout) -> Self { //error: Ambiguous type name in 'SnapshotTransformViewOptions'

        switch layout {
        case .grid:
            return Self(
                pieceSizeRatio: .init(width: 1.0 / 4.0, height: 1.0 / 10.0),
                piecesCornerRadiusRatio: .static(1)

hello, I am trying to use an swift package to customize the paging about collection view, but I got "Ambiguous type name" error. What should I do here?

1 Answers

Try to use that Layout enum as SnapshotTransformViewOptions.Layout, that should fix the problem ( and I think that's the best practice for nested classes,enum, or structs )

Related