Skip to content

What is Secrets.swift? Cannot build in Xcode. #3

Open

Description

@bracklanna

Can you please expand the README to explain how the Secrets.swift file is supposed to be added/configured within Xcode before attempting to build?


bracklanna
Xcode 11.3.1 / Mojave 10.14.6

Activity

  1. dwightmulcahy commented on Aug 21, 2020

    @dwightmulcahy

    Secrets.swift basically defines Secrets.apiKey which is the API key that you need from airnowapi.org.

    You can get that value from creating an account at https://www.airnowapi.org
    and doing this: https://docs.airnowapi.org/forecastsbyzip/query
    generate a query and it will look something like this

    http://www.airnowapi.org/aq/forecast/zipCode/?format=text/csv&zipCode=94086&date=2020-08-21&distance=25&API_KEY=<really-long-random-string>
    

    take the <really-long-random-string> part and replace the \(Secrets.apiKey) with it in this line:

    let urlString = "http://www.airnowapi.org/aq/observation/zipCode/current/?format=application/json&API_KEY=\(Secrets.apiKey)&zipCode="

    Also delete the Secrets.swift file reference in xcode and you will be able to build and run it now.

    If I get around to it I might put in a PR that will make the API Key a part of the config menu...

    dWiGhT
    Xcode 11.6 / Catalina 10.15.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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