I will show you all the source code of released iOS application!
Tags: ios, swift, xcode
Published: 2018-06-14 13:07:10

---
title: I will show you all the source code of released iOS application!
published: true
description: 
tags: iOS,swift,xcode
---

# I will show you all the source code of released iOS application!

# Introduction

This time, I thought about publishing the source code of the application for the following reasons.

- I want many people to see the application I made.
- I want to hear opinions of various people.
- I would like to help those who make apps by sharing code.

I hope this article will be useful to everyone 😃

# Introduction of the application
Innovy (Innovy).
It is a news application for 20s to 30s (mainly men) who are setting up antennas for gathering information on latest services and technologies.
※ I made the name that imagined an innovator (innovator).

![AppIcon 1024 _ 1.jpg](https://qiita-image-store.s3.amazonaws.com/0/160811/203eb665-a087-c7d5-d762-8ec5546e770e.jpeg)

You can see latest news by genre and user's reaction.
Moreover, because there is a news read-out function, you can also check news while walking.
App URL:https://itunes.apple.com/us/app/Innovy/id1319179144

### screenshot
![IMG_5140_4.jpg](https://qiita-image-store.s3.amazonaws.com/0/160811/ed3c3726-c922-6634-0da7-3d21050a8e1b.jpeg)

#### ① News list screen
You can check various genres of news on the top page of the application.
Tap on the news to change the genre with the detail screen, horizontal swipe.

#### ② News list screen (press long news)
After long press of the news, start reading aloud from the place where the news was selected with "tap from this position" tap.

#### ③ News detail screen (reading articles)
You can check the details of the news.
From this screen you can check tweets about news clips and news on display.

#### ④ Tweet list screen
You can check tweets about selected news from the list.
You can tweet by pressing tweet button.

#### ⑤ Article search screen
You can search past news.

#### ⑥ Setting screen
You can check the weather forecast of the current location and change the settings of the application.

# Launch public source code and applications

First of all, I access the following URL.

https://github.com/RyutaMiyamoto/Innovy

`Clone or download` →` Download ZIP` to download the project.
Please unzip the downloaded zip file.
<img width="512" alt="Screenshot 2018-06-02 13.38.55.png" src = "https://qiita-image-store.s3.amazonaws.com/0/160811/d153df5f-e3f6-d8f3-8390-618ce33f4cb4.png">

Install the library using the following cocoaPods.
Please refer to [another article] (https://qiita.com/ShinokiRyosei/items/3090290cb72434852460) how to install cocoaPods.
After installing cocoaPods open the terminal, go to the Innovy-master folder, enter the `pod install` command and wait until the library installation is over.

After installing the library, open the Innovy - master folder and open `likeNews.xcworkspace`.
Recommended environment: XCode 9.3

<img width ="629" alt ="Screenshot 2018-06-02 13.40.00.png" src="https://qiita-image-store.s3.amazonaws.com/0/160811/9525f431-af88-134c-0176-e2a9476f4dcd.png">

After opening XCode, select the appropriate terminal with `iOS Simulators` and press the` Run button`.

<img width="917" alt="Screenshot 2018-06-02 13.50.29.png" src="https://qiita-image-store.s3.amazonaws.com/0/160811/9adea365-f29c-8ab6-5d8c-e98f350de534.png">

Successful when simulator & application starts.
Of course, if you set Provisioning Profile, it is also possible to operate in real machine.

<img width="208" alt="Screenshot 2018-06-02 14.33.22.jpg" src="https://qiita-image-store.s3.amazonaws.com/0/160811/b8009f75-b0d8-8c12-3b0d-e7769012f20b.jpeg">

Firebase plist, API key for API with limit of number of times etc. are masked, so some are not displayed.
If you contact us separately, we will pass items that are masked 🙃
* However, I will limit it to those who are clear on their identity (on Facebook etc.).

# Architecture introduction
Innovy adopts [MVVM (Model-View-ViewModel)] (https://en.wikipedia.org/wiki/Model_View_ViewModel) as the architectural pattern?

For example, when the user performs the operation of reacquiring the latest news on the news list screen (pulls the screen upward), it moves as follows.
* Consider `NewsListViewController` in code as` View`, `NewsListViewModel` as` ViewModel` and `NewsListModel` as` Model`.

![Architecture.jpg](https://qiita-image-store.s3.amazonaws.com/0/160811/29efe10f-5caa-8af5-7bea-b1334f2b346b.jpeg)

①. `View` detects? Update operation by user
②. `View` requests update process to` ViewModel`
③ `ViewModel` asked` Model` to acquire news list
④. `Model` uses the news list acquisition API to acquire the latest news
⑤. `Model` notifies` ViewModel` of completion of news acquisition
⑥. Create data for `View` display based on the news list` ViewModel` obtained from `Model`
⑦. `ViewModel` notifies` View` of completion of data creation
⑧. `View` updates screen based on` ViewModel` information

So the latest news information is reflected in the application 😉


# Introduction of library used in application
### [R.swift] (https://github.com/mac-cain13/R.swift)
Since it is possible to acquire the image file name and the Storyboard name as properties, it prevents errors due to typing errors.
Image file name, alert message ?, xib name etc used everywhere.

### [Alamofire] (https://github.com/Alamofire/Alamofire)
A library for facilitating HTTP communication.
Everyone is using it for iOS application development that communicates, is not it?
Used in the API communication part.

### [SDWebImage] (https://github.com/rs/SDWebImage)
Just specifying a URL for UIImageView will display the image, loading display, cache it will cache.
Used in the display portion of the article image.

### [Unbox] (https://github.com/JohnSundell/Unbox)
A library that parses Json.
Used in the place to retrieve Json acquired by API for use inside the application.

### [Realm] (https://github.com/realm/realm-cocoa)
Application version database.
The data access syntax is very easy to understand.
Used for storing article information.

### [CTFeedback] (https://github.com/rizumita/CTFeedback)
A library that makes it easy to create an inquiry screen.
Used on the inquiry screen.

### [SVProgressHUD] (https://github.com/SVProgressHUD/SVProgressHUD)
A library for displaying indicators representing processing in front of the screen.
Used while acquiring article information.

### [HockeySDK] (https://github.com/bitstadium/HockeySDK-iOS)
A library that collects crash reports when crashing applications.
Set at startup.

### [Firebase] (https://github.com/firebase/)
Application general search library such as application usage survey, crash report viewing, push notification?
Set at startup.

### [NendSDK_iOS] (https://github.com/fan-ADN/nendSDK-iOS)
A library for displaying advertisements.
Used when displaying articles.

# Introduction to API
## Article information acquisition API (self-made) (likeNews/getNews.php)
API for retrieving article information?
Used when displaying the list.

## Genre information acquisition API (homebrew) (likeNews/getGenre.php)
API for getting genre information?
Genres include "startup", "service", "design" and others.
Used at startup.

## Article article score addition API (homebrew) (likeNews/updateNewsScore.php)
API to add the number of times you saw the article details.
Tap any article from the article list and use it at the timing of opening the article details.
By this, when you display the article you can display "other people ○ people are paying attention to this article!"?

## [Tweet Information Acquisition API] (https://api.twitter.com/)
API to acquire tweet information from Twitter to acquire
Article detail screen? When you tap the tweet button at the bottom, a tweet list is displayed, but it is used when acquiring the list.

## [Weather Information Acquisition API] (https://openweathermap.org/)
API for getting weather information.
By specifying latitude and longitude, weather information of the place can be acquired.
Used when displaying weather information displayed on the setting screen.

## [Location Information Retrieval API] (https://geoapi.heartrails.com)
? API for obtaining location information.
If you specify latitude and longitude, you can obtain the address of that place in Japanese.
Since weather information API can only obtain addresses in English, we will separately obtain addresses using this API.
Used with weather information API.

At the end

How was that.

Read this article and open your iOS application

Original Article:
https://qiita.com/ryupaka/items/ea272c843d3ebf3b245b