StackOverflowFeed - Simple app that show feed with questions from StackOverflow, using Stack Exchange API

Overview

StackOverflowFeed

Simple app that show feed with questions from StackOverflow, using Stack Exchange API


I've Used the MVVM design pattern because I think it's a much better design than MVC, where we get huge controllers with too much responsibility. I think that Controllers should be simple and dumb as possible. In the code you will be able to see i kept all logic in the view models + i'm always thinking how can I decouple my viewmodels as much as possible from each other. In order to achieve decoupling I used: dependency injection, delegates and completion closure.


To fetch Data I used https://api.stackexchange.com/, in the app user can choose through Segment controller if he want to see all questions regardless of their state (Answered / Unanswered), only Answered questions and only questions with no answers. App will fetch the most recent questions. I've created 3 different filter to achieve this:

Refresh: I Used tableViewController.refreshControl to refresh the table. Users can refresh by swiping the table down from the top. (as on Instagram app)

Paradigms: Requests for the next page with new models will take place when the last cell of the table view will be displayed.


I've encountered few problems during building the App:

  1. Problem: In the Task I've been asked to filter with Answers/noAnswer but the api does not provide an endpoint for questions with answers (https://api.stackexchange.com/docs). Solution: I've queried a filter for answers. When user click on specific question i'm building the link for the question from the model.question_id

  2. Problem: When app first launch when I tried to fetch data on viewDidLoad(), fetching data taking to long and TableView show empty for 1-2 seconds until data is retrieve and table is refreshed Solution: From what I was taught and experienced Singletons are bad practice for most of the time. I usually tried to avoid them as much as possible. But, in this scenario i made the QuestionsManager a Singleton so i can init him and fetch the models for the first View user's interact with, on the Success callback I changed the root window viewcontroller, then I passed to Datasource.setup() the StackOverflowQuestionsManager.shared as a "dependency injected". However I would rather think of some better design than use a singleton here. So to conclude, in SceneDelegate I'm changing the window?.rootViewController to be the LaunchScreen and fetching first models (All questions as it by default the first screen) in the completion handler i'm changing the window?.rootViewController to be the rootviewcontroller of the main storyboard. That way I'm making sure the QuestionsManager singleton object has models to show when building table views.

  3. Problem: Load the WKWebView before showing the webview: Solution: I've added a UIActivityIndicatorView for better UX. Can be approved in my honest opinion.

You might also like...
Simple app to show usage of SwiftUI and Combine
Simple app to show usage of SwiftUI and Combine

Podcasts Simple app to show usage of SwiftUI and Combine. The app shows a list of podcasts fetched from listennotes and it can be played. Status: Work

Kinopoisk clone iOS app using Swift, TMDb API, Youtube API and SDWebImage.
Kinopoisk clone iOS app using Swift, TMDb API, Youtube API and SDWebImage.

📱 Kinopoisk clone iOS app using Swift, TMDb API, Youtube API and SDWebImage. App mainly developed to learn about Swift(UIKit), working with JSON, using MVVM architectural pattern.

Demo to show Air Quality Indices of Cities (in India) using SwiftUI and Combine Framework

AirQualityMonitoring-SwiftUI-Combine Demo to show Air Quality Indices of Cities (in India) using SwiftUI and Combine Framework Demo Video City List wi

MovieAppSwiftUI - The Application is using TMDB API and Server API to reduce user searching movies resources time with search engine
MovieAppSwiftUI - The Application is using TMDB API and Server API to reduce user searching movies resources time with search engine

MovieAppSwiftUI The Application is using TMDB API and Server API to reduce user searching movies resources time with search engine.This Application is

Swift iPhone and iPad Client for Polls API, using Hyperdrive API client
Swift iPhone and iPad Client for Polls API, using Hyperdrive API client

Polls Client This is a Swift iPhone and iPad client for the Polls API - a simple application allowing users to view polls and vote in them. Polls is a

This is the simple iOS app for browsing and saving recipes, using Spoonacular API
This is the simple iOS app for browsing and saving recipes, using Spoonacular API

TastyDojoApp This is the simple iOS app for browsing and saving recipes, using Spoonacular API This project includes: MVVM Pattern Searching through t

A Simple Weather App Using the Open Weather Map api

The Weather, a Simple Weather App Using the Open Weather Map api. This app demos use of the Open Weather Map api. The UI is simple, with views of the

An iOS app demo to show list and detail screen of artworks.
An iOS app demo to show list and detail screen of artworks.

Artworks iOS Demo Application Architecture MVP Clean Architecture (check Known Issues) Dependency Injection Features Localization Dark mode support Ba

Swift iOS app to track when your favorite tv show airs next 📆
Swift iOS app to track when your favorite tv show airs next 📆

Upcoming TV Swift iOS app to track when your favorite tv show airs next 📆 Requirements iOS 13 TMdB API key Credits TMdB Contact github.com/dkhamsing

Owner
null
Mahmoud-Abdelwahab 5 Nov 23, 2022
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
Grid-based app for macOS Catalyst (Mac Idiom) with navigation stack

Catalyst Grid App Simple Catalyst example (Mac idiom) of a grid-based app with a push/pop navigation stack. Includes back button in toolbar that auto-

Steven Troughton-Smith 120 Nov 14, 2022
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
iOS app for your pasteboard feed

iCopyPasta iOS app for your pasteboard feed, demo app for experimenting with RxSwift. You can read the story about it on All The Flow blog. ##Install

All The Flow 23 Oct 27, 2022
An open-source SwiftUI Stack Overflow client

StackOv A SwiftUI Stackoverflow client We are currently in the developing process of the next version of StackOv app. The demo version of StackOv is a

Surf 235 Dec 17, 2022
Full Stack Mobile Application built with Flutter, Java Spring-Boot and MongoDB

??‍?? Calling all chefs! Pocket Recipes is a recipe storage application with additional features that make organizing your recipes very easy.

Hayden Hanson 2 Dec 5, 2022
Essential Feed Course

Essential Feed App – Image Feed Feature BDD Specs Story: Customer requests to see their image feed Narrative #1 As an online customer I want the app t

Sebastián León 0 Nov 25, 2021
Realtime feed of ERC721 transfers

Building Notes As a quick hack for handling secrets (like API keys), I just put

PJ Gray 1 Jan 28, 2022
An iOS app that visually clones Spotify's app and consumes the official Spotify's Web API to show(and play) songs, podcasts, artists and more.

SpotifyClone An iOS app that visually clones Spotify's app and consumes the official Spotify's Web API to show(and play) songs, podcasts, artists and

Gabriel Denoni 11 Dec 27, 2021