How do I convert this code to Swift
typedef UIViewController<CalendarViewControllerNavigation> CalendarViewController;
tried to find solution everywhere but seems I can't find a reference to this.
How do I convert this code to Swift
typedef UIViewController<CalendarViewControllerNavigation> CalendarViewController;
tried to find solution everywhere but seems I can't find a reference to this.
In Swift 4 you can use:
typealias CalendarViewController = UIViewController & CalendarViewControllerNavigation
Which uses the new protocol composition type. Also see SE-156.
I was facing same issue to use calendar library from https://github.com/jumartin/Calendar.
I have solved this problem as below.
protocol CalendarViewControllerNavigation: NSObjectProtocol {
func move(to date: Date, animated: Bool)
}
typealias CalendarTypeController = UIViewController
extension CalendarTypeController:CalendarViewControllerNavigation{
internal func move(to date: Date, animated: Bool) {
}
internal func deviceIsRotated() {
}
internal func selectedEventForAddSession(event:EventDetail) {
}
}
protocol CalenderViewControllerDelegate : NSObjectProtocol {
func calendarViewController(_ controller:CalendarTypeController, showDate:NSDate)
}
Hope this code will help you!