Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Moving constants to seprate file #238

Closed
wants to merge 18 commits into from
Closed

Conversation

SIMRAN1
Copy link
Contributor

@SIMRAN1 SIMRAN1 commented Mar 13, 2018

Description

Moved all constants to seprate file.

Fixes #222

Type of Change:

Delete irrelevant options.

  • Code
  • Quality Assurance
  • User Interface
  • Outreach
  • Documentation

Code/Quality Assurance Only

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update (software upgrade on readme file)
  • New feature (non-breaking change which adds functionality pre-approved by mentors)

How Has This Been Tested?

Describe the tests you ran to verify your changes. Provide instructions or GIFs so we can reproduce. List any relevant details for your test.

Checklist:

Delete irrelevant options.

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials
  • I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged

Code/Quality Assurance Only

  • My changes generate no new warnings
  • My PR currently breaks something (fix or feature that would cause existing functionality to not work as expected)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been published in downstream modules

@SIMRAN1
Copy link
Contributor Author

SIMRAN1 commented Mar 13, 2018

@sunjunkie please review the pr

@sunjunkie
Copy link
Contributor

Simply extracting the constants into a separate file is not a good enough solution. We lose all context of what the constants mean. And if a constant will only ever be used in one class only, it does not make sense at all.
It is much better to group the constants into separate 'types' where the type name provides some meaning to the constant. These type namespaces can be implemented with enums. See Documentation.
In some use cases, caseless enums with static let properties is even better (avoids the "rawValue" requirement for enums and the chance of accidental instantiation.) See example.

@sunjunkie sunjunkie closed this Mar 16, 2018
@SIMRAN1
Copy link
Contributor Author

SIMRAN1 commented Mar 16, 2018

okk @sunjunkie mam I have seen this approach..Now should I group constants using enums and solve this issue.??

@sunjunkie
Copy link
Contributor

You can work on this. It would be good to discuss your approach before you code in Slack/#powerup.

@SIMRAN1
Copy link
Contributor Author

SIMRAN1 commented Mar 16, 2018

okk @sunjunkie mam I will discuss in slack group.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Strings.swift to group strings in enums and update accessors throughout the app.
2 participants