Skip to content

ListRepoModuleView presentDetailRepoModuleModule(repo) passes nil repo? #4

@apparition47

Description

@apparition47

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 git@github.com:apparition47/iOSSwiftStarter.git

Using XCode 8.1 on macOS 10.11.6.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions