mapbox / mapbox/mapbox-navigation-ios

Reorganize CoreConstants.swift to not extend specific classes

Open
#2,716 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

archived
Dominant language
Swift
Stars
918
Forks
326
Avg merge
1h 16m
Merged PRs (30d)
3

Description

I posted a notification in NavigationService and added a userInfoKey to CoreConstants, but I couldn't use NavigationService as a namespace by extending it with a NotificationUserInfoKey struct. I got a compiler error: `Type 'NavigationService.NotificationUserInfoKey' does not conform to protocol 'RawRepresentable'`. Instead, I had to use MapboxNavigationService.

Reorganizing CoreConstants.swift to have a single NotificationUserInfoKey struct at the top level instead of extending specific classes will prevent this issue from arising in the future.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in CoreConstants.swift and inspect the existing NotificationUserInfoKey definition and its extensions on NavigationService and MapboxNavigationService. Trace references to the key and notification userInfo, then reorganize the constant so those references compile without class-specific extensions. Done means the project builds and the existing notification usage remains valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.