iOSSwiftStarter icon indicating copy to clipboard operation
iOSSwiftStarter copied to clipboard

ListRepoModuleView presentDetailRepoModuleModule(repo) passes nil repo?

Open apparition47 opened this issue 7 years ago • 0 comments

Hi, I'm trying to get your project working and I almost have it working with a few tweaks (see below). But when I tap on the list to get to the detail page, the detail page doesn't show the repo's title like it should.

image

Any idea what's going on here?

ListRepoModuleView.swift

func showRepos(repos: Array<Repo>, pulledToRefresh: Bool) {
    self.data = repos;
    self.resetRepoCellModels(pulledToRefresh);
}

func resetRepoCellModels(pulledToRefresh: Bool) {
    var cellModels: Array<RepoCellModel> = Array<RepoCellModel>();
    
    for repo: Repo in self.data {
        let cellModel: RepoCellModel = RepoCellModel(avatarUrl: repo.avatarUrl!, name: repo.name!) { _ in
// **************
            debugPrint(repo.name) // prints nil here ????
            self.presenter?.presentDetailRepoModuleModule(repo); // passed to the next view but is nil
// **************
            self.tableView.deselectRowAtIndexPath(self.tableView.indexPathForSelectedRow!, animated: true);
        };
        
        cellModels.append(cellModel);
    }
    
    Async.main {
        if(self.hakuba.sectionsCount > 0) {
            self.hakuba[0].reset(cellModels)
                .bump();
        } else {
            let section = Section();
            self.hakuba
                .insert(section, atIndex: 1)
                .bump();
            self.hakuba[0].append(cellModels)
                .bump();
        }
    }
// ...
nil
Printing description of repo:
<iOSSwiftStarter.Repo: 0x6180000d5690> (entity: Repo; id: 0xd000000014000000 <x-coredata://ABC1CF60-4B55-48F0-A86C-CA4250C27333/Repo/p1280> ; data: <fault>)

I have your starter here: git clone -b issue-3 [email protected]:apparition47/iOSSwiftStarter.git

Using XCode 8.1 on macOS 10.11.6.

Thanks!

apparition47 avatar Nov 16 '16 09:11 apparition47