On this page
Overview
Moya is a Swift networking abstraction built on Alamofire. Endpoints are modeled as enum cases conforming to TargetType, centralizing URLs, HTTP methods, parameter encoding, headers, and sample data while using the same provider API for live requests and stubs.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Model API endpoints as enum cases that conform to TargetType
Each endpoint can define its base URL, path, method, task, headers, and sample data in one typed target. This keeps request construction out of ad hoc view and service code.
Sources: [3]
Use MoyaProvider for both live requests and test stubs
MoyaProvider<Target> sends a target and returns either a Response or MoyaError. Sample data and endpoint configuration make it possible to build stubs around the same TargetType definitions used by live networking.
Sources: [3]
Best fit
Fits iOS applications that want consistent networking conventions across many endpoints
It is useful when teams want URLs, methods, parameters, and headers expressed as typed API definitions while reducing direct Alamofire calls. CombineMoya, RxMoya, and ReactiveMoya are also exposed as package products.
Before adoption
The latest GitHub release is 15.0.3, so verify compatibility with the current toolchain
Release 15.0.3 was published in 2022. Its Package.swift declares Swift tools 5.3, iOS 10+, and an Alamofire 5 dependency. The repository has 2026 activity, but the long release interval makes it important to verify builds, warnings, and dependency resolution with the Swift and Xcode versions used by the application.
Official sources
- [1]Moya/Moya — GitHub repository(2026-10-06)
- [2]Moya 15.0.3 — Readme(2026-10-06)
- [3]Moya 15.0.3 — Basic Usage(2026-10-06)
- [4]Moya 15.0.3 — Package.swift(2026-10-06)
- [5]Moya 15.0.3 release(2026-10-06)
- [6]Moya MIT license(2026-10-06)
Supplemental curator note
Moya fits iOS applications that want one typed convention for endpoint URLs, methods, parameters, and headers. The latest release is 15.0.3 and is relatively old, so verify it with the Swift/Xcode and Alamofire versions used by your CI before adoption.
Try it in 3 steps
- 1
Add Moya 15.0.3 with SwiftPM
Pin the reviewed latest GitHub release. The Moya target depends on Alamofire 5.x.
.package(url: "https://github.com/Moya/Moya.git", exact: "15.0.3") - 2
Define an API endpoint with TargetType
Follow the official Basic Usage example and keep URL, path, method, task, and sample data in one typed target.
import Moya enum MyService { case zen } extension MyService: TargetType { var baseURL: URL { URL(string: "https://api.myservice.com")! } var path: String { "/zen" } var method: Moya.Method { .get } var task: Task { .requestPlain } var headers: [String: String]? { nil } var sampleData: Data { Data("ok".utf8) } } - 3
Send the target through MoyaProvider
Retain the provider, send the target, and confirm that the request completes as a Moya Result.
let provider = MoyaProvider<MyService>() provider.request(.zen) { result in print(result) }
Growth
Growth trends · Last 30 days
15,353 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 0
- Open PRs
- 19
Development activity is still being collected.
Built with
Categories and tags
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- swift
- reactiveswift
- rxswift
- alamofire
- networking
- hacktoberfest
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- DeviceKit4,733 Stars
3 shared tag(s) · 2 shared category(s) · Same language
augment UIDevice with value-typed device models, simulator detection, battery state, and hardware capabilities
Swift - Flutter179,343 Stars
3 shared tag(s) · 2 shared category(s)
build mobile, web, and desktop UI from one Dart codebase
Dart - React Native126,797 Stars
3 shared tag(s) · 2 shared category(s)
native mobile UI with React, stable 0.87.1, and a framework-first path
C++ - Expo52,566 Stars
3 shared tag(s) · 2 shared category(s)
build React Native apps for Android, iOS, and web from one project model
TypeScript - SDWebImage25,612 Stars
3 shared tag(s) · 2 shared category(s)
manage UIKit network images with asynchronous downloads and memory/disk caching
Objective-C - http4k2,791 Stars
3 shared tag(s) · 2 shared category(s)
serve, consume, and test HTTP services as Kotlin functions
Kotlin
Report incorrect information
Tell us if any listing information is incorrect or outdated.