Aplikasi iOS Berita Internasional dengan SwiftUI, API dari newsapi.org, MVVM Design Pattern, dan Paw

Last update: Jun 14, 2022

iNews

iNews adalah aplikasi iOS Berita Internasional yang datanya didapatkan dari News API. Dibuat menggunakan SwiftUI, MVVM Design Pattern, dan Paw. Aplikasi ini memiliki fitur Search, Filter, Bookmark, Search History, Safari Browser, dan Sharing URL Berita.

Preview

Folder & File Structure

iNews mengikuti pedoman design pattern dengan 3 komponen, yaitu Model, View, & ViewModel (MVVM). Berikut struktur file dan folder pada iNews:

.
├── iNewsApp.swift
├── ContentView.swift
├── news.json            
├── info
├── API                        # API: API Service (Fetch Data)
│   └── NewsAPI.swift          # Berisikan Fungsi Decode JSON File, Fetch (data & response) via URL Session, & Generate Berita (search & kategori)
│
├── Models                     # Models: API Data Declaration
│   ├── Article.swift          # Berisikan Endpoints Data yang digunakan dari API
│   ├── Category.swift         # Berisikan Kategori berita (Raw Data)
│   ├── DataStore.swift        # Berisikan Concurrency Type untuk membantu menghindari masalah ketika terjadi update pada value
│   └── NewsAPIResponse.swift  # Berisikan API Response Code (Handler)
│
├── ViewModel                           # ViewModel: Information Handler & CRUD Logic
│   ├── ArticleBookmarkViewModel.swift  # Berisikan Fungsi CRUD untuk Fitur Bookmark
│   ├── ArticleNewsViewModel.swift      # Berisikan Fungsi Load Berita dari API
│   └── ArticleSearchViewModel.swift    # Berisikan Fungsi CRUD untuk Fitur Search dan Search History
│
└── Views                           # Views: Controller UI & Frontend Related (Show & Get)
    ├── ArticleListView.swift       # Berisikan Tampilan Berita dalam Bentuk List
    ├── ArticleRowView.swift        # Berisikan Tampilan Berita (Card)
    ├── BookmarkTabView.swift       # Berisikan Tampilan Halaman Bookmark
    ├── EmptyPlaceholderView.swift  # Berisikan Skeleton Card Berita (ketika loading / fetching data)
    ├── NewsTabView.swift           # Berisikan Tampilan Halaman Beranda Aplikasi
    ├── RetryView.swift             # Berisikan Tampilan Retry
    ├── SafariView.swift            # Berisikan Fungsi untuk Membuka Browser Safari dari URL Berita
    ├── SearchHistoryListView.swift # Berisikan Komponen dari List Riwayat Pencarian
    └── SearchTabView.swift         # Berisikan Tampilan Halaman Search

Features:

  • CRUD -> Kategori Berita, Bookmark, & Search History
  • MVVM Design Pattern
  • Search
  • Filter Kategori
  • Bookmark
  • Sharing Berita URL
  • Safari Browser

Build With:

Installation

Untuk menggunakan repositori ini, ikutilah petunjuk penggunaan berikut dan pastikan git sudah terinstall pada komputer (semua perintah dilaksanakan pada cmd.exe atau terminal):

  1. Lakukan download .zip atau clone repositori dengan cara:
git clone https://github.com/dekapd99/iNews.git
  1. Buka project di Xcode dan copy API Key dari newsapi.org.
  2. Jika sudah, buka Project Navigation klik API > NewsAPI.swift, paste string pada variabel apiKey dengan API Key Anda.
  3. Build & Run

License

No License

(back to top)

GitHub

https://github.com/dekapd99/iNews
You might also like...

iOS native app demo with Xcode and Swift using MVVM architecture and Apple's Combine framework for functional reactive programming, all with UIKit

iOS native app demo with Xcode and Swift using MVVM architecture and Apple's Combine framework for functional reactive programming, all with UIKit

iOS (Swift 5): MVVM test with Combine and UIKit MVVM and functional reactive programming (FRP) are very used in iOS development inside companies. Here

Dec 31, 2021

Create a simple MVVM-C iOS architecture with Swift for starters

iOS-Architecture-MVVM MVVM+Coordinators IOS Architecture Tutorial By Bobby Pehtr

Dec 30, 2021

Demonstration blackjack app for native iOS. Uses MVVM architecture

Demonstration blackjack app for native iOS. Uses MVVM architecture

Blackjack - native iOS application This project is a simple demonstration on how to intergrate swiftUI with MVVM architecture. Although, technically,

Feb 7, 2022

iOS protocol-oriented MVVM examples

iOS protocol-oriented MVVM examples

MVVM-Example Protocol-Oriented MVVM example apps. Sample projects: MVVM-Example - A Settings screen that has one settings – put your app in Minion Mod

May 5, 2022

MVVM-of-SuYeon - Build an Instagram iOS App Clone with Cloud Firestore, Swift 5

MVVM-of-SuYeon Instagram Firestore App Clone | Swift 5 + iOS 14 | MVVM Build an

Feb 16, 2022

📖 Design Patterns implemented in Swift 5.0

📖 Design Patterns implemented in Swift 5.0

Jun 18, 2022

This is Github user search demo app which made by many variety of design patterns.

This is Github user search demo app which made by many variety of design patterns.

iOSDesignPatternSamples This is Github user search demo app which made by many variety of design patterns. Application Structure SearchViewController.

Jun 24, 2022

Rabble Wabble - This is small Project implemented with respected design patterns

Rabble Wabble - This is small Project implemented with respected design patterns

Rabble_Wabble This is small Project implemented with respected design patterns D

Feb 2, 2022

SpaceX rocket listing app using RxSwift and CLEAN Architecture with MVVM

SpaceX rocket listing app using RxSwift and CLEAN Architecture with MVVM

Jibble SpaceX rocket listing app using RxSwift and CLEAN Architecture with MVVM Demo Features Reactive Bindings URL / JSON Parameter Encoding Filter Y

Dec 5, 2021
Comments
  • 1. Search Berita

    Program berjalan, semua fitur berjalan selain search berita. Hasil: Unsupported URL

    Penyebab: belum tau -> No Error

    Warning: async - await syntax -> Task.init

    Reviewed by dekapd99 at 2022-06-08 16:14
  • 2. Bookmark di ArticleListView

    Aplikasi tetap berjalan cuma gak menampilkan berita apapun karena ada masalah di image icon bookmark

    Penyebab error:

    1. Thread 1: Fatal error: No ObservableObject of type ArticleBookmarkViewModel found. A View.environmentObject(_:) for ArticleBookmarkViewModel may be missing as an ancestor of this view.
    2. No ObservableObject of type ArticleBookmarkViewModel found. A View.environmentObject(_:) for ArticleBookmarkViewModel may be missing as an ancestor of this view.

    CrashReportError: Preview is missing environment object "ArticleBookmarkViewModel"

    iNews crashed due to missing environment of type: ArticleBookmarkViewModel. To resolve this add .environmentObject(ArticleBookmarkViewModel(...)) to the appropriate preview.

    // Bookmark button Button { toggleBookmark(for: article) } label: { // jika ada Artikel yang di Bookmark maka munculkan icon Bookmark Fil, jika tidak ada maka pakai icon bookmark biasa Image(systemName: articleBookmarkVM.isBookmarked(for: article) ? "bookmark.fill" : "bookmark") }

    Reviewed by dekapd99 at 2022-06-07 14:02
  • 3. Load API thumbnail berita from Https

    bug muncul ketika gambar gagal load tapi berita bisa dibuka via URL safari. Untuk saat ini aplikasi tetep jalan tapi gambar tidak berhasil di load walaupun di refresh berkali kali

    Reviewed by dekapd99 at 2022-06-06 16:34
NewsAppMVVM - A Swift iOS App created to practice MVVM Design Pattern
NewsAppMVVM - A Swift iOS App created to practice MVVM Design Pattern

NewsAppMVVM A Swift iOS App created to practice MVVM Design Pattern. This app re

Jan 3, 2022
Exemplify a LazyVGrid in SwiftUI in a MVVM pattern with Mock Data and images in assets.
Exemplify a LazyVGrid in SwiftUI in a MVVM pattern with Mock Data and images in assets.

SwiftUI-LazyVGrid Exemplify a LazyVGrid in SwiftUI in a MVVM pattern with Mock Data and images in assets. Screenshots Samples IP & Credits All those b

Apr 25, 2022
ProductListSwiftUI - SwiftUI Project to fetch product list using the fakestoreapi and the MVVM architectural pattern
ProductListSwiftUI - SwiftUI Project to fetch product list using the fakestoreapi and the MVVM architectural pattern

ProductListSwiftUI SwiftUI Project to fetch product list using the fakestoreapi

Feb 18, 2022
MMVMi: A Validation Model for MVC and MVVM Design Patterns in iOS Applications

MMVMi MMVMi: A Validation Model for MVC and MVVM Design Patterns in iOS Applications Motivation Design patterns have gained popularity as they provide

May 17, 2021
This a simple swiftui app where i used mvvm architecture, coredata swiftui and so on..
This a simple swiftui app where i used mvvm architecture, coredata swiftui and so on..

SwiftUI MVVM COREDATA NOTE APP This a simple swiftui app where i used mvvm architecture, coredata swiftui and so on... #FEATURES SWIFTUI MVVM COREDATA

May 23, 2022
MockChat TDD MVVM SwiftUI - Mockable, Test driven Development, clear Architecture example using SwiftUI
MockChat TDD MVVM SwiftUI - Mockable, Test driven Development, clear Architecture example using SwiftUI

MockChat_TDD_MVVM_SwiftUI Mockable, Test driven Development, clear Architecture

Feb 5, 2022
Cryptocurrency price checker, build with UIKit and MVC + Delegate pattern.
Cryptocurrency price checker, build with UIKit and MVC + Delegate pattern.

Coin Check Cryptocurrency price checker. The app fetch from CoinAPI.io the latest coin prices, build with UIKit and MVC + Delegate pattern. Features S

Jan 10, 2022
A demo demonstrates how to use combine and MVVM in the SwiftUI app
A demo demonstrates how to use combine and MVVM in the SwiftUI app

SwiftUI-MVVM-Combine A demo demonstrates how to use combine and MVVM in the Swif

Jun 6, 2022
An app to demo networking with SwiftUI/MVVM
An app to demo networking with SwiftUI/MVVM

Network Demo An app to demonstrate how network calls can be implemented in a SwiftUI/MVVM app. Motivations Apple's introductory tutorial is a great st

Jun 21, 2022
Mini-application iOS native avec Xcode et Swift exploitant l'architecture MVVM et le framework Combine d'Apple pour la mise en place de la programmation réactive fonctionnelle, le tout avec UIKit.
Mini-application iOS native avec Xcode et Swift exploitant l'architecture MVVM et le framework Combine d'Apple pour la mise en place de la programmation réactive fonctionnelle, le tout avec UIKit.

iOS (Swift 5): Test MVVM avec Combine et UIKit L'architecture MVVM et la programmation réactive fonctionnelle sont très utlisées dans le développement

Nov 28, 2021