Skip to content

olgazinchenko/NewsApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NewsApp

Screenshot 2025-02-28 at 14 01 34 NewsApp is an iOS application built with UIKit that fetches and displays news articles from NewsAPI.org. The app supports browsing top headlines, filtering by category, and searching for news by keywords.

Features

  • Top Headlines: View the latest news headlines.
  • Categories: Browse news by categories (e.g., General, Business, Technology).
  • Search: Filter news articles by keywords.
  • Image Loading: Display article images seamlessly.

Requirements

  • Xcode: 14 or later
  • iOS: 17.4 or later
  • Swift: 5

Setup

1. Clone the Repository

git clone https://github.com/olgazinchenko/NewsApp.git

2. Open the Project in Xcode

Navigate to the project folder and open the Xcode project:

cd NewsApp
open NewsApp.xcodeproj

3. Configure Your API Key

This project uses NewsAPI.org to retrieve news data. To keep your API key secure:

1. Create a Secrets.xcconfig file:

In your project, create a file named Secrets.xcconfig (make sure it’s not tracked by Git—add it to your .gitignore):

API_KEY = YOUR_NEWSAPI_KEY_HERE

2. Configure Info.plist:

In your Info.plist, add the following key-value pair to reference the API key from the xcconfig file:

<key>API_KEY</key>
<string>$(API_KEY)</string>

3. Load the API Key in Code:

In your ApiManager.swift, load the API key like this:

private static let apiKey: String = {
    guard let key = Bundle.main.object(forInfoDictionaryKey: "API_KEY") as? String, !key.isEmpty else {
        fatalError("API_KEY not set in Info.plist")
    }
    return key
}()

4. Update .gitignore:

Add Secrets.xcconfig to your .gitignore to prevent accidental commits of your API key:

Secrets.xcconfig

4. Build and Run

After configuring your API key, build and run the app on the iOS Simulator or a physical device using Xcode.

Usage

  • Browse News: The main screen displays top headlines for the selected category.
  • Search News: Use the search bar to find articles by keywords.
  • Read Articles: Tap on an article to view its details.

Contributing

Contributions are welcome! If you have suggestions or bug fixes, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License.

Acknowledgments

  • NewsAPI.org for providing a free API to access news data.

About

NewsApp is an iOS application built with UIKit that fetches and displays news articles from NewsAPI.org. It allows users to browse top headlines, filter by category, and search for news using keywords.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages