objc-TimesSquare icon indicating copy to clipboard operation
objc-TimesSquare copied to clipboard

No access to tableView in Swift

Open frios opened this issue 8 years ago • 0 comments

I was looking through your sample application and when translating the following code to Swift 3:

- (void)scroll;
{
    static BOOL atTop = YES;
    TSQCalendarView *calendarView = (TSQCalendarView *)self.view;
    UITableView *tableView = calendarView.tableView;
    
    [tableView setContentOffset:CGPointMake(0.f, atTop ? 10000.f : 0.f) animated:YES];
    atTop = !atTop;
}

I get an error:

Value of type TSQCalendarView has no member tableView

In order to give access to the tableView in Swift, I have moved the declaration of the tableView property from TSQCalendarView.m to TSQCalendarView.h

Is this a reasonable option?

frios avatar Feb 02 '17 19:02 frios