Skip to content

A skill assessment project, powered by SwiftUI and tzkt REST api.

License

Notifications You must be signed in to change notification settings

Requieem/tzktSample_IOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Forks Stargazers Issues GNU GPLv3.0 License LinkedIn

tzktSample

tzktSample is a SwiftUI application developed in Xcode, designed to fetch and display lists of blockchain blocks and transactions using the tzkt.io REST API. This project showcases SwiftUI views, ViewModel architecture, and network request handling in Swift.

Features

  • Fetch and display a list of blockchain blocks.
  • Fetch and display transactions for a specific block.
  • Pull-to-refresh functionality in lists.
  • Dependency injection for network services, enhancing testability.
  • Comprehensive unit tests for ViewModels and network services.

Required Tech

All the version reported below are what the app was built and tested with, forward or backward compatibility should not be a problem but is not guaranteed. Please report any incompatibilities.

  • iOS 16.4+ (should be good down to around 15.0)
  • Xcode 14.0+
  • Swift 5.0+

Installation

Clone the repository, and open the project in Xcode:

git clone https://github.com/Requieem/tzktSample_IOS.git
cd tzktSample
open tzktSample.xcodeproj

Usage

The application consists of two main views:

  1. BlockListView: Displays a list of blockchain blocks. Each block can be tapped to view its transactions.

  2. TransactionListView: Shows transactions for the selected block.

Pull down on either list to refresh the content.

Architecture

This project follows the MVVM (Model-View-ViewModel) architecture:

  • Model: Represents the data structure (e.g., Block, Transaction).
  • View: SwiftUI views for user interface (e.g., BlockListView, TransactionListView).
  • ViewModel: Logic layer that handles data fetching and processing (e.g., VM_BlockTable, VM_TransactionTable).

Networking

Network requests are handled by APIService, which is abstracted behind URLSessionProtocol to enable mocking for unit tests.

Testing

Unit tests are written using XCTest framework. MockURLSession and MockAPIService are used to simulate network responses.

Folder Structure

This is the current structure of the project:

tzktSample/
│
├── Fonts/
│ └── Urbanist/
│
├── tzktSample/
│ ├── Utility/
│ │ ├── CustomDateFormatter.swift
│ │ ├── CustomJsonDecoder.swift
│ │ └── APIService.swift
│ │
│ ├── Protocols/
│ │ └── URLSessionProtocol.swift
│ │
│ ├── ViewModel/
│ │ ├── VM_BlockTable.swift
│ │ └── VM_TransactionTable.swift
│ │
│ ├── View/
│ │ ├── BlockTable.swift
│ │ ├── TransactionTable.swift
│ │ └── Header.swift
│ │
│ └── Model/
│ └── tzktSampleApp/
│
├── Assets/
│ └── Preview Content/
│
└── tzktSampleTests/
├── Mocks/
│ ├── MockURLSession.swift
│ ├── MockDecodable.swift
│ └── MockAPIService.swift
│
├── APIServiceTests.swift
├── VM_BlockTableTests.swift
└── VM_TransactionTableTests.swift

External Tools

During the development of tzktSample, several external tools were utilized to aid in the design, testing, and validation of the application:

Postman

Postman was used for testing and interacting with the tzkt.io REST API. This helped in understanding the API responses and structuring the network layer of the app accordingly.

To explore and test the API endpoints used in this project, you can use the following Postman collection:

Run in Postman

Figma

The user interface design and prototyping were conducted using Figma. Figma enabled quick iteration over the app's UI/UX design, ensuring a user-friendly experience.

You can view the Figma designs for this project here: TZKT Figma Design

License

This project is licensed under the GNU GPLv3.0 License - see the LICENSE file for details.

Credit where it's due

This README.md file was structured following this awesome template!

About

A skill assessment project, powered by SwiftUI and tzkt REST api.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages