-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I am a complete beginner to coding, so take everything below with a grain of salt! I experience the following error, diagnosed by LLMs. If this is indeed an error, I would appreciate a fix - otherwise I apologise.
Problem
The LongTermScheduler and ShortTermScheduler structs are declared as public but lack explicit public initializers, making them unusable from external modules.
Error Message
'LongTermScheduler' initializer is inaccessible due to 'internal' protection level
Root Cause
In Swift, when a public struct has no stored properties and no custom initializer, the compiler generates a default init() with internal access level, not public.
Current Code
public struct LongTermScheduler: Scheduler {
public func schedule(...) -> CardReview {
// implementation
}
}Solution
Add explicit public initializers:
public struct LongTermScheduler: Scheduler {
public init() { } // Add this line
public func schedule(...) -> CardReview {
// existing implementation
}
}
public struct ShortTermScheduler: Scheduler {
public init() { } // Add this line
public func schedule(...) -> CardReview {
// existing implementation
}
}Impact
This prevents external users from creating instances of the schedulers, effectively making the library unusable as intended.
Workaround
Currently, users must implement their own Scheduler conforming types instead of using the provided implementations.