Can we detect whether epub is at the last position [ Swift ] #572
Unanswered
parthshethi2e
asked this question in
Q&A
Replies: 1 comment
-
There's no easy way to do that, as the last position is often not what you expect; you may want to skip indexes and bibliographies for example. But a pretty naïve way of doing that would be to check that you reached the last position when observing the location: override func navigator(_ navigator: Navigator, locationDidChange locator: Locator) {
if
let position = locator.locations.position,
positionCount == try? await publication.positions().get().count,
position >= positionCount - 1
{
// Reached the last position.
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Can we detect whether epub is at the last position [ Swift ]
Beta Was this translation helpful? Give feedback.
All reactions