Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Example iOS app designed using MVVM-C and Clean Architecture. Uses Swift Concurrency.

License

NotificationsYou must be signed in to change notification settings

denissimon/iOS-MVVM-Clean-Architecture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

514 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swift VersionPlatformsLicense: MIT

Example iOS app designed using MVVM-C and Clean Architecture. Uses Swift Concurrency.

The app retrieves images for any search query or tag via the Flickr API. It has three modules: ImageSearch, ImageDetails, HotTags.

Architecture concepts used here

Includes

  • Reusable and universalNetworkService based on URLSession
  • Reusable and universalSQLite wrapper around SQLite3
  • Image caching service
  • Configurable use ofUIKit orSwiftUI for the same screen
  • Advanced error handling
  • Unit and integration tests for a number of components from all layers

Main layers

Presentation (MVVM):coordinators,UI elements,SwiftUI views,UIKit storyboards,ViewControllers,ViewModels

Domain:entities,use cases,services,interfaces

Data:entity repositories,APIs,API/DB interactors (or network services and persistent storages),adapters

Detailed architecture overview

Use case scenarios

ImageSearch module:

* searchImagesUseCase.execute(imageQuery)* imageCachingService.cacheIfNecessary(data)* imageCachingService.getCachedImages(searchId: searchId)

ImageDetails module:

* getBigImageUseCase.execute(for: image)

HotTags module:

* getHotTagsUseCase.execute()

Image caching service

ImageCachingService implements the logic for caching downloaded images and freeing memory. This helps keep the app's memory usage under control, since there can be a lot of downloaded images, and without caching, the app could quickly accumulate hundreds of MB of memory used. Downloaded images are cached and read from the cache automatically.

Reusable components from this project

  • SwiftEvents - the easiest way to implement data binding and notifications. Includes Event<T> and Observable<T>. Has a thread-safe version.
  • URLSessionAdapter - a Codable wrapper around URLSession for networking
  • SQLiteAdapter - a simple wrapper around SQLite3

Swift 6 support

For a Swift 6 version with SWIFT_STRICT_CONCURRENCY = complete, see theswift6 branch.

Requirements

iOS 15.0+, Xcode 13.0+, Swift 5.5+

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2026 Movatter.jp