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

Overview

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)

You might also like...
Braze is a Crypto Currency App created using SwiftUI with MVVM architecture.
Braze is a Crypto Currency App created using SwiftUI with MVVM architecture.

Braze A Crypto Currency App created using SwiftUI with MVVM architecture. Braze tracks live prices of crypto coins and can create mock portfolio. Usin

📖 Design Patterns implemented in Swift 5.0

📖 Design Patterns implemented in Swift 5.0

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.

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

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

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

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

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

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,

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

Comments
  • Search Berita

    Search Berita

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

    Penyebab: belum tau -> No Error

    Warning: async - await syntax -> Task.init

    bug 
    opened by dekapd99 1
  • Bookmark di ArticleListView

    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") }

    bug 
    opened by dekapd99 1
  • Load API thumbnail berita from Https

    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

    enhancement 
    opened by dekapd99 0
Owner
DK
Improving skills through project everyday
DK
A sample project exploring MVVM pattern with SwiftUI/Combine, using Unsplash API (via Picsum.photos API)

CombineUnsplash A sample project exploring MVVM pattern with SwiftUI/Combine, using Unsplash API (via Picsum.photos API) with detail example. Resource

Vinh Nguyen 26 Dec 13, 2022
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

Jorge Roberto 1 Jan 3, 2022
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

Ethan Halprin 3 Aug 9, 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

Vitalii Shapovalov 4 Sep 16, 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

Mariam AlJamea 11 Aug 19, 2022
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

Isaias Cuvula 1 Jul 20, 2022
MockChat TDD MVVM SwiftUI - Mockable, Test driven Development, clear Architecture example using SwiftUI

MockChat_TDD_MVVM_SwiftUI Mockable, Test driven Development, clear Architecture

Zahirul Islam 0 Feb 5, 2022
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

Anibal Ventura 0 Jan 10, 2022
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

Asa. Ga 7 Jul 5, 2022
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

Tatsuya Kaneko 6 Oct 7, 2022