Git Product home page Git Product logo

codesample's Introduction

CodingAssessmentApp

Fetch NYTimes Api to show news.

Swift Version Build Status License Platform PRs Welcome

minio_SWIFT1

Version

1.0

Prerequisites

  • Xcode 9.3 or later
  • iOS 9.0 or later
  • macOS 10.13 or later

1. Dependencies

We will be building this app using Xcode 9.3 with Swift 4.0. This app will also consume the NYTimes API Service built to get news according to days.

  • Xcode 9.0
  • Swift 4.0

2. Library Dependencies

  • SDWebImage (This library provides an async image downloader with cache support.)
  • Reachablity (Provided by apple for network monitoring)
  • SwiftLint (A tool to enforce Swift style and conventions, loosely based on GitHub's Swift Style Guide.)

3. Written in Swift

This sample is written in Swift.

Tools

  • CocoaPods - CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 33 thousand libraries and is used in over 2.2 million apps. CocoaPods can help you scale your projects elegantly.
  • SonarQube 7.2.1 - SonarQube provides the capability to not only show health of an application but also to highlight issues newly introduced. With a Quality Gate in place, you can fix the leak and therefore improve code quality systematically.
  • SwiftLint - A tool to enforce Swift style and conventions.
  • Sonar-swift 0.3.7 - This is an open source plugin for Apple Swift language support in SonarQube.

Design Patterns

  • MVC

Model-View-Controller (MVC) is one of the building blocks of Cocoa and is undoubtedly the most-used design pattern of all. It classifies objects according to their general role in your application and encourages clean separation of code based on role.

minio_SWIFT1

  • Facade

The Facade design pattern provides a single interface to a complex subsystem. Instead of exposing the user to a set of classes and their APIs, you only expose one simple unified API.

minio_SWIFT1

  • Decorator

The Decorator pattern dynamically adds behaviors and responsibilities to an object without modifying its code. It’s an alternative to subclassing where you modify a class’s behavior by wrapping it with another object.

In Swift, there are two very common implementations of this pattern: Extensions and Delegation.

Features

  • API class : AppApiManager
  • MVC pattern used (recommanded by Apple)
  • Ready to fetch others section or period (see Parameters struct).
  • Modular enough to add others calls from NY Times API.
  • Ready for background fetch (using URLSession with delegate).
  • Unit Testing using XCTest
  • UI Testing using XCUITest
  • CI/CD - Sonar Qube

Installation

*Cloning or downloading the repository

  • Go to working directory
  • Open CodingAssessmentApp.xcworkspace
  • Use command + B or Product -> Build to build the project
  • Press run icon in Xcode or command + R to run the project on Simulator

Step to run the project from command-line

  • Make sure command-line tools of Xcode is installed
  • Go to working Directory
  • xcodebuild -scheme CodingAssessmentApp build -allowProvisioningUpdates

Step to static code coverage

  • Open CodingAssessmentApp.xcworkspace
  • Use Command+Shift+B or Product+Analyze to analyze the project

minio_SWIFT1

Step to execute test cases

  • Use Command+U or Product+Test to execute the test case

Linting

  • SwiftLint is used for linting.

Code Coverage

  • Installation (once for all your Swift projects)
  • Download the plugin binary into the $SONARQUBE_HOME/extensions/plugins directory
  • Copy run-sonar-swift.sh somewhere in your PATH
  • Restart the SonarQube server.
  • Configuration (once per project)
  • Copy sonar-project.properties in your Xcode project root folder (along your .xcodeproj file)
  • Edit the sonar-project.properties file to match your Xcode iOS project
  • Update (once per plugin update)
  • Install the lastest plugin version
  • Copy run-sonar-swift.sh somewhere in PATH

minio_SWIFT1

To Do

CI/CD

Crash Reporting

License

Distributed under the MIT license. See LICENSE for more information.

https://github.com/laxmansahni/CodeSample/blob/master/LICENSE

codesample's People

Contributors

laxmansahni avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.