Easily create UIViewControllers for news articles similar to those in the News app.

Overview

MRArticleViewController

CI Status Version License Platform

This framework allows you to easily setup View Controllers to display News Articles inspired by those from the Apple News App. Simply set the required fields and run, and you will have a nice looking view for your articles.

Preview Preview Preview

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • Swift 3: use current
  • Swift 2: use v0.2.0

Installation

MRArticleViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'MRArticleViewController'

Usage

  1. Import the module
import MRArticleViewController
  1. Subclass ArticleViewController
class ViewController: ArticleViewController
  1. In viewDidLoad, set the following required properties before super.viewDidLoad():
override func viewDidLoad() {
    // required
    imageView.image = UIImage(named: "pulpfiction")!
    headline = "LA gangsters witness supposed \"Divine Intervention\""
    author = "Quentin Tarantino"
    date = NSDate()
    body = bodyText

    super.viewDidLoad()
}
  1. Optional: In viewDidLoad, set the following optional properties before super.viewDidLoad():
...

// Uses the algorithm from UIImageColors to extract the colors from the image and color the
// background, headline, author, date, and body accordingly. Defaults to false, but highly
// recommended to set to true. More on this feature below.
autoColored = true

// If you don't like the autoColor feature, you can also color each component individually
backgroundColor = UIColor.black
headlineColor = UIColor.yellow
authorColor = UIColor.orange
dateColor = UIColor.gray
bodyColor = UIColor.gray

super.viewDidLoad()

Done! 🍻

More on autoColored

This library leverages the algorithm from UIImageColors. Setting autoColor = true extracts the colors from the image and applies the

  • background color to the background
  • the primary color to the headline
  • the detail color to the date and body
  • and the secondary color to the author.

Note that UIImageColors is not a dependency, the code has just been ported into this library.

To-do

Want a feature you don't see? Submit an issue and I'll add it to the to-do list, or hack it yourself and submit a pull request.

  • Add new styles
  • Swift package manager

Author

Matthew Rigdon, [email protected]

License

MRArticleViewController is available under the MIT license. See the LICENSE file for more info. Please also refer to Panic's original license for the autoColor feature.

You might also like...
EzNews - A simple and easy to use News app for iOS and iPadOS. It uses NewsAPI as its backend

EzNews This was my first proper Swift app. Its a news app made for iOS and iPadO

Flutter news app with NewsApi Org
Flutter news app with NewsApi Org

Installation flutter pub get Usage flutter run Learn I will show how to create a flutter news app with NewsApi Org, In Flutter News App we will load

NewsApp- - Built A News App With SwiftUI and Mock Data
NewsApp- - Built A News App With SwiftUI and Mock Data

News APP Built A News App With Swift UI and Mock Data Screen Gif

News App 📱 built to demonstrate the use of SwiftUI 3 features, Async/Await, CoreData and MVVM architecture pattern.
News App 📱 built to demonstrate the use of SwiftUI 3 features, Async/Await, CoreData and MVVM architecture pattern.

Box Feed News App 📱 built to demonstrate the use of following features, SwiftUI 3 Async/Await AsyncImage List Refreshable Swipe Actions Separator Cor

This is a sample app to create a photo selection classifier using CreateML on an iOS Device.
This is a sample app to create a photo selection classifier using CreateML on an iOS Device.

PhotoSelectionClassifier This is a sample app to create a photo selection classifier using CreateML on an iOS Device. Demo In the demo video below, we

ScriptWidget is an iOS app that we can create widgets for iOS using JSX label style in JavaScript.
ScriptWidget is an iOS app that we can create widgets for iOS using JSX label style in JavaScript.

ScriptWidget ScriptWidget is an iOS app that we can create widgets for iOS using JSX label style in JavaScript. Source code for ScriptWidget. Download

Timetinerary is an iOS app that allows you to create, save, and share continuous schedules.
Timetinerary is an iOS app that allows you to create, save, and share continuous schedules.

Timetinerary is an iOS app that allows you to create, save, and share continuous schedules. These schedules can be converted into a widget and notifications.

An iOS app that allows you to create resumes on your phone and export them to pdf

Resume Builder iOS An iOS app that allows you to create resumes on your phone and export them to pdf To create a new resume, choose + from the main vi

Create a weather app from scratch with this SwiftUI Crash Course
Create a weather app from scratch with this SwiftUI Crash Course

"Create a weather app from scratch with this SwiftUI Crash Course" https://youtu

Owner
Matt Rigdon
Software Engineer at Salesforce
Matt Rigdon
Rhythm helps those with Parkinson's more easily coordinate their gait with rhythmic audio.

Rhythm-Parkinson-s-App Rhythm helps those with Parkinson's more easily coordinate their gait with rhythmic audio. Research https://davisphinneyfoundat

Andreas Ink 1 Dec 13, 2021
Headline News Widget for Better Touch Tool. You can display the articles fetched by rss.

BTTPluginHeadLineNews This is a headline news widget plugin for BTT(Better Touch Tool) You can display the articles fetched by rss. (Pock version is h

null 4 Jul 23, 2022
MyNews-iOS - A simple iOS mobile application for reading news articles

MyNews A simple iOS mobile application for reading news articles. This app uses

Ernest Nyumbu 1 Mar 31, 2022
A Full News App based on the latest SwiftUI 3/iOS 15 API that fetches latest news from newsapi.org

SwiftUI NewsAPI App A Full News App based on the latest SwiftUI 3/iOS 15 that fetches latest news from newsapi.org. Features The app has several main

Alfian Losari 139 Jan 2, 2023
harry potter themed social network similar to IG

Potter Pics PotterPics is a Harry Potter themed social network similar to Instagram. Walkthrough Home, Main Feed, Profile Library Post, Search, Camera

suraya shivji 150 Dec 1, 2022
Simple news iOS app with SwiftUI

NewsUI Simple news iOS app with SwiftUI ??️ which uses NewsAPI to fetch top news headlines The codebase uses following modern keys: SwiftUI Async/Awai

Fumiya Yamanaka 19 Dec 22, 2022
App Everything in one place (news, weather, stocks and much more)

Dashy Everything in one place (news, weather, stocks and much more) I tried to follow MVVM Pattern, Used Decodable And URLSession instead of thrid-par

Aayush 3 Nov 24, 2021
A News Feed App Built With Swift

News Feed App TabBarController'ımızın ilk tabında "newsapi.org"dan gelen veriyi kullanıcıya gösteriyoruz. Başlangıç url'indeki sonuçları gösteren sayf

Hasan Ali 2 Oct 24, 2022
A simple iOS App that reads from the Test Flight News API

README Table of contents General info Unit Testing Technologies Revision Updates Setup General info SpaceFlight is a simple app built using the MVVM d

Diego Bustamante 0 Oct 28, 2021
App for displaying VK news feed (VKSDK API). Clean Swift VIP architecture

VKNewsFeed VKNewsFeed - application for displaying VK news feed with dynamic cells and a collection of images in the post. Data request occurs from th

Areg Vardanian 0 Dec 18, 2021