Supported in Swift
This page lists the Swift libraries, frameworks and build tools Niro was tested against, and whether it recognised each one.
What the marks mean.
- Supported: Niro recognised every way of using it that the test code tries.
- Partly: Niro recognised some of those ways, or recognised one only in part.
- Not yet: Niro did not recognise it in the test code.
The test code is made up for the purpose: one small service per library, with the names invented. So "supported" means Niro recognised it there. It is good evidence, but it is not a promise about every codebase. If Niro misses something in your code, the coverage audit reports the gap on its own (see Coverage audit).
The test catalog also holds 5 look-alike cases for Swift: code that Niro must NOT take for a route, a call or a store. They test that Niro ignores the look-alike, so they are left out of this page and its counts.
Web frameworks and HTTP servers (the routes your code serves)
1 supported, 1 partly, 4 not yet.
| Name | Status | Ways of using it that were tested |
|---|---|---|
| Hummingbird | partly | yes: let router = Router(); router.get("path") { request, context in } yes: router.post("path", use: handler) yes: router.group("api").get("x/:id") { .. } no: RouteCollection(context:).get(":id", use:) added with router.addRoutes(_:atPath:) |
| Kitura | not yet | no: router.get("/path") { request, response, next in } |
| Perfect | not yet | no: routes.add(method: .get, uri: "/path") { request, response in } |
| Swifter | not yet | no: server["/path"] = { request in } and server.GET["/path"] = { } no: server.POST["/path"] = { } |
| SwiftNIO | not yet | no: ChannelInboundHandler with switch (head.method, head.uri) cases |
| Vapor | supported | yes: app.get("path") { req in ... } with a trailing closure yes: app.post("path", use: handler) and path segments as separate arguments yes: app.on(.PATCH, "path", use: handler) yes: let api = app.grouped("api", "v1"); api.get(..) yes: app.group("admin") { admin in admin.post(..) } yes: struct X: RouteCollection { func boot(routes:) { routes.grouped("x").get(use: h) } } registered with app.register(collection:) yes: invoices.group(":id") { invoice in invoice.delete(use: delete) } inside boot(routes:) |
The language's own HTTP server
0 supported, 0 partly, 1 not yet.
| Name | Status | Ways of using it that were tested |
|---|---|---|
| Network.framework NWListener | not yet | no: NWListener(using: .tcp, on: port) with newConnectionHandler reading the request line |
HTTP client libraries (the calls your code makes to other services)
1 supported, 2 partly, 2 not yet.
| Name | Status | Ways of using it that were tested |
|---|---|---|
| Alamofire | partly | yes: AF.request("url").response { } yes: AF.request(url, method: .post, parameters:, encoder:) no: let session = Session(configuration:); session.request(url) partly: AF.upload(data, to: url) yes: AF.download(url) yes: try await AF.request(url).serializingString().value |
| AsyncHTTPClient | partly | partly: var r = HTTPClientRequest(url:); r.method = .POST; HTTPClient.shared.execute(r, timeout:) yes: HTTPClient(eventLoopGroupProvider:).get(url:).wait() |
| Moya | not yet | no: enum API: TargetType with baseURL, path and method in switch branches; MoyaProvider<API>().request(.case) |
| swift-openapi-generator | not yet | no: Client(serverURL:transport: URLSessionTransport()) then client.<operationId>() from openapi.yaml |
| Vapor | supported | yes: Vapor's client: req.client.get("absolute url") yes: req.client.post(URI(string: url)) { try $0.content.encode(..) } |
The language's own HTTP client
0 supported, 1 partly, 1 not yet.
| Name | Status | Ways of using it that were tested |
|---|---|---|
| Network.framework NWConnection | not yet | no: NWConnection(host:port:using: .tcp) then send(content: "GET /path HTTP/1.1...") |
| URLSession | partly | yes: URLSession.shared.dataTask(with: URL(string:)!) { } .resume() yes: try await URLSession.shared.data(from: URL) yes: var request = URLRequest(url:); request.httpMethod = "POST"; request.httpBody = ..; data(for: request) yes: try await URLSession.shared.upload(for: request, from: data) yes: URLSession.shared.uploadTask(with: request, from: data) { }.resume() yes: try await URLSession.shared.download(from: URL) yes: URLSession.shared.downloadTask(with: URL) { }.resume() yes: try await URLSession.shared.bytes(from: URL) yes: let session = URLSession(configuration: .ephemeral); session.data(from:) partly: base URL from ProcessInfo environment with a literal fallback, joined with + partly: client class holding session and baseURL; baseURL.appendingPathComponent(path); path given by the caller |
gRPC
1 supported, 1 partly, 1 not yet.
| Name | Status | Ways of using it that were tested |
|---|---|---|
| connect-swift | not yet | no: Connect: ProtocolClient(httpClient:config:) and generated <Pkg>_<S>Client(client:).<rpc>(request:) |
| grpc-swift | partly | yes: server v1, form implements: class X: <Pkg><S>Provider with func <rpc>(request:context:) -> EventLoopFuture yes: registration: Server.insecure(group:).withServiceProviders([X()]).bind(host:port:) yes: server v1 async, form implements: class X: <Pkg><S>AsyncProvider with async throws methods no: client v1, form constructor: <Pkg><S>NIOClient(channel:) then client.<rpc>(req).response no: client v1, form constructor: <Pkg><S>AsyncClient(channel:) then try await client.<rpc>(req) |
| grpc-swift-2 | supported | yes: server v2, form implements: struct X: <Pkg><S>.SimpleServiceProtocol; GRPCServer(transport:services:) yes: client v2, form constructor: <Pkg><S>.Client(wrapping: grpcClient) inside withGRPCClient |
Databases and data stores
3 supported, 3 partly, 7 not yet.
| Name | Status | Ways of using it that were tested |
|---|---|---|
| CloudKit | supported | yes: CKRecord(recordType: "X") saved with database.save; CKQuery(recordType:) |
| Core Data | not yet | no: NSFetchRequest<T>(entityName: "X") then context.fetch(request) no: Order.fetchRequest() from a NSManagedObject subclass, then context.fetch no: NSEntityDescription.insertNewObject(forEntityName: "X", into: context); context.save() no: context.execute(NSBatchDeleteRequest(fetchRequest: NSFetchRequest(entityName:))) |
| FileManager | supported | yes: FileManager.default.createFile(atPath:contents:attributes:) / contents(atPath:) |
| Firebase Firestore | not yet | no: db.collection("x").document(id).setData(..) / .getDocuments() no: db.collection("x").addDocument(data:) |
| Fluent | not yet | no: Model.query(on: db).filter(..).all() with static let schema = "table" no: model.save(on: db) no: (db as? SQLDatabase).raw("SQL").run() |
| GRDB | not yet | no: db.execute(sql:arguments:) inside dbQueue.write { db in } no: Row.fetchAll(db, sql:) no: record type with databaseTableName; Invoice.fetchAll(db), invoice.insert(db) |
| MongoKitten | not yet | no: db["collection"].insert(..) / .find(..) |
| PostgresNIO | partly | yes: PostgresClient.query("SQL with (interpolation)", logger:) partly: client.withConnection { connection in connection.query(..) } yes: shared table: main writes shipments that services/fluent reads |
| RealmSwift | partly | yes: realm.objects(Type.self) partly: try realm.write { realm.add(instance) } |
| RediStack | not yet | no: redis.set("key", to: v) / redis.get("key", as:) |
| SQLite.swift | supported | yes: let carts = Table("carts"); db.run(carts.insert(..)); db.prepare(carts) yes: db.execute("raw SQL") |
| SwiftData | not yet | no: context.fetch(FetchDescriptor<Model>(predicate:)) on a @Model class no: modelContext.insert(Model(..)) no: SwiftUI @Query var items: [Model] |
| UserDefaults | partly | yes: UserDefaults.standard.set(v, forKey: "k") / .string(forKey:) no: UserDefaults(suiteName: "group.x")?.set(v, forKey:) no: SwiftUI property wrapper @AppStorage("key") |
Messaging and events (queues, topics, streams)
6 supported, 1 partly, 4 not yet.
| Name | Status | Ways of using it that were tested |
|---|---|---|
| CocoaMQTT | supported | yes: mqtt.publish("topic", withString:) yes: mqtt.subscribe("topic", qos:) with didReceiveMessage yes: shared MQTT topic: main publishes warehouse/temperature |
| Combine | supported | yes: in-process: subject.send(value) on a PassthroughSubject yes: in-process: CurrentValueSubject.send(value) |
| DistributedNotificationCenter | not yet | no: macOS cross-process: DistributedNotificationCenter.default().postNotificationName(..) / addObserver(forName:) |
| nats.swift | supported | yes: nats.subscribe(subject:) / nats.publish(data, subject:) yes: shared NATS subject: main publishes shipments.created |
| NotificationCenter | supported | yes: NotificationCenter.default.post(name: Notification.Name("X"), object:) yes: post(name: .orderPlaced) where .orderPlaced is declared in an extension of Notification.Name yes: addObserver(forName:object:queue:) { note in } yes: addObserver(self, selector: #selector(f), name: Notification.Name("X"), object:) yes: NotificationCenter.default.publisher(for: name).sink { } yes: for await _ in NotificationCenter.default.notifications(named:) |
| rabbitmq-nio | supported | yes: channel.basicPublish(from:exchange:routingKey:) / basicConsume(queue:) |
| RediStack | supported | yes: redis.publish(message, to: "channel") yes: redis.subscribe(to: "channel") { channel, message in } yes: shared Redis channel: main publishes stock-updates |
| Soto (AWS SNS) | not yet | no: sns.publish(.init(message:topicArn:)) |
| Soto (AWS SQS) | not yet | no: sqs.sendMessage(.init(messageBody:queueUrl:)) no: sqs.receiveMessage(.init(queueUrl:)) no: shared SQS queue URL: main sends to refunds |
| swift-kafka-client | partly | no: producer.send(KafkaProducerMessage(topic: "t", value:)) no: KafkaConsumerConfiguration(consumptionStrategy: .group(id:topics: ["t"])); for try await m in consumer.messages partly: shared topic: main produces orders.placed that services/swift-kafka consumes |
| Vapor Queues | not yet | no: req.queue.dispatch(Job.self, payload); struct Job: AsyncJob { func dequeue } |
Build tools and package managers
8 supported, 0 partly, 0 not yet.
| Name | Status | Ways of using it that were tested |
|---|---|---|
| Bazel rules_swift | supported | yes: MODULE.bazel + BUILD.bazel with swift_binary and swift_library, no Package.swift |
| Carthage | supported | yes: Cartfile; Carthage/Checkouts (sources) and Carthage/Build (frameworks) beside an Xcode project |
| CocoaPods | supported | yes: Podfile with a remote pod (vendored under Pods/) and a development pod by :path with a .podspec |
| SwiftPM | supported | yes: one Package.swift: executableTarget with main.swift, a library target, a testTarget yes: products: .executable and .library; @main type instead of main.swift yes: two app packages depend on a local library package by .package(path:) yes: a .macro target (swift-syntax) and a build-tool .plugin under Plugins/, used by an executable |
| Tuist | supported | yes: Workspace.swift and Project.swift manifests (Swift code importing ProjectDescription) per project |
| Xcode project | supported | yes: ShopApp.xcodeproj with an app target, a framework folder and a unit-test folder; no Package.swift |
| Xcode workspace | supported | yes: Shop.xcworkspace referencing two .xcodeproj (app and framework) |
| XcodeGen | supported | yes: project.yml declaring an application target and a framework target by source folder |
Project and folder layouts
1 supported, 1 partly, 0 not yet.
| Name | Status | Ways of using it that were tested |
|---|---|---|
| SwiftPM | supported | yes: targets with path: outside Sources/ (Server/Sources, Shared/Lib, Server/Tests) yes: .build/ (checkouts and debug output), .swiftpm/ and DerivedData/ beside Package.swift, no .gitignore yes: several SwiftPM services under services/<name>/ (code in Sources/, not src/), split by a root docker-compose.yml |
| Xcode project | partly | partly: one app target mixing Swift and Objective-C through a bridging header |