{"action":"opened","issue":{"url":"https://api.github.com/repos/xmartlabs/Eureka/issues/1117","repository_url":"https://api.github.com/repos/xmartlabs/Eureka","labels_url":"https://api.github.com/repos/xmartlabs/Eureka/issues/1117/labels{/name}","comments_url":"https://api.github.com/repos/xmartlabs/Eureka/issues/1117/comments","events_url":"https://api.github.com/repos/xmartlabs/Eureka/issues/1117/events","html_url":"https://github.com/xmartlabs/Eureka/issues/1117","id":237200700,"number":1117,"title":"Previous row selection stops if rows where not visible in table view anymore","user":{"login":"torstenlehmann","id":5949960,"avatar_url":"https://avatars1.githubusercontent.com/u/5949960?v=3","gravatar_id":"","url":"https://api.github.com/users/torstenlehmann","html_url":"https://github.com/torstenlehmann","followers_url":"https://api.github.com/users/torstenlehmann/followers","following_url":"https://api.github.com/users/torstenlehmann/following{/other_user}","gists_url":"https://api.github.com/users/torstenlehmann/gists{/gist_id}","starred_url":"https://api.github.com/users/torstenlehmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torstenlehmann/subscriptions","organizations_url":"https://api.github.com/users/torstenlehmann/orgs","repos_url":"https://api.github.com/users/torstenlehmann/repos","events_url":"https://api.github.com/users/torstenlehmann/events{/privacy}","received_events_url":"https://api.github.com/users/torstenlehmann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-20T12:58:37Z","updated_at":"2017-06-20T12:58:37Z","closed_at":null,"body":"commit: 2dca38882d30aafb1ab16b1db2db29056050b348\r\nXcode 8.3.2 (8E2002)\r\niOS 10.3 (14E269)\r\n\r\nWhile using the previous button on a form it can happen that the non visible rows at the top of the form do not become first responder even if `cellCanBecomeFirstResponder() == true`. Also the inputAccessoryView does not update to the next previous cell.\r\n\r\nIt seems to be an issue with `navigateTo(direction:)`\r\n\r\n```swift\r\n// true\r\nif nextRow.baseCell.cellCanBecomeFirstResponder() {\r\n    // scroll works too\r\n    tableView?.scrollToRow(at: nextRow.indexPath!, at: .none, animated: animateScroll)\r\n    // returns false\r\n    nextRow.baseCell.cellBecomeFirstResponder(withDirection: direction)\r\n}\r\n```\r\n\r\nIt looks like becoming first responder before `cellForRowAtIndexPath` was executed for this cell, fails.\r\n\r\nI created a workaround for this: https://github.com/torstenlehmann/Eureka/commit/7d3de0632e49ba2a7fac405e842c1c3ba949adde\r\n\r\nI save the cell to navigate to in a property and use this property in a `FormViewController` subclass in `tableViewWillDisplayCell`:\r\n\r\n```swift\r\n    // A previous row did not became first responder, if it was not added to the table view anymore (presumably).\r\n    //\r\n    // This is fixed by a workaround where the last cell that was navigated to is cached in a property in\r\n    // FormViewController and then SubFormViewController uses this property to execute\r\n    // cellBecomeFirstResponder again on tableViewWillDisplayCell.\r\n    func tableView(_: UITableView, willDisplay cell: UITableViewCell, forRowAt _: IndexPath) {\r\n        if let cell = cellToNavigateTo {\r\n            cellToNavigateTo = nil\r\n            cell.cellBecomeFirstResponder()\r\n        }\r\n    }\r\n```\r\n\r\nThe subclass is not needed I guess, but I wanted to change as little as possible in Eureka, because I can't estimate what assumptions this will break. Not sure how this can be fixed in a clean way."}}
{"actor":{"display_login":"torstenlehmann"}}