How to call public but internal type in Swift?

Viewed 39

I would call here in Validator https://github.com/kylef/JSONSchema.swift/blob/master/Sources/Validator.swift

the validate method, but got this error, though method is public. What can I do to avoid this issue?

Function cannot be declared public because its result uses an internal type

extension Validator {
  public func validate(instance: Any) throws -> ValidationResult {

my code:

import JSONSchema

let validator = try! JSONSchema.validator(for: schema)
let r2: ValidationResult = validator.validate(instance: d2)

Shall I add public init() {} to .. Validator, or ValidationResult?!

Initializer is inaccessable due to 'internal' protection level

Seems it is not possible, those are protocol or enum.

0 Answers
Related