Skip to content

Crash on - [ResponsiveLabel performActionAtIndex:] in swift 3.0 #45

@davehenke

Description

@davehenke

Perhaps I'm defining my closure wrong, but when defining a closure to work with a responsive label, the subsequent action execution attempts to pull a closure out of self.textStorage at memory address 0x00000

In this example, cell.containedView is a ResponsiveLabel, and hashtagResponder is an ivar defined as:

fileprivate var hashtagResponder: PatternTapResponder?
hashtagResponder = { [weak self] hashtag in
    if let strongSelf = self, let hashtag = hashtag {
        strongSelf.delegate?.didTapHashtag(name: hashtag, storySectionController: strongSelf)
    }
}
cell.containedView.enableHashTagDetection(attributes: [NSForegroundColorAttributeName : UIColor.primaryBrand, RLTapResponderAttributeName : hashtagResponder! as AnyObject])

screen shot 2017-06-12 at 1 37 23 pm

(lldb) po tapResponder
0x0000000000000000

This is not a reuse issue, because the controller that owns the PatternTapResponder is still in memory.

Any help is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    hacktoberfestIssues to be solved during Hacktoberfest

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions