
📱 一个强类型、缓存的 iOS GraphQL 客户端,使用 Swift 编写。
概览
阿波罗 iOS Apollo iOS 提供强大的缓存、强大的代码生成和直观的 API,加速您的应用开发。 ✅ - 智能内存或SQLite开箱✅即用 - 网络响应的手写模型时代已经结束!✅- 引导用户走向“成功深渊”,并默认鼓励良好✅实践- 支持全球无数应用,服务数百万终端用户 你应用中任何使用 ApolloClient 的目标都必须依赖 Apollo 产品。 仅使用阿波罗生成模型的目标不需要与阿波罗产品关联。 * - 问答与讨论 * - 与社区的实时聊天 今天就用我们全面的API编排工具套件,交付明天的路线图: * - 类型安全应用,支持GraphQL驱动的设备缓存(React、iOS、Kotlin)* - 将所有GraphQL和REST API组合到一个GraphQL端点 * - AI需要API。
概述(AI 翻译)
Apollo iOS 是一个强类型缓存的 GraphQL 客户端,使用 Swift 编写。
它允许你对 GraphQL 服务器执行查询和变异,并以查询专用的 Swift 类型返回结果。这意味着你不必处理解析 JSON,也不用手动传递字典,也不用让客户端将值转换为正确类型。你也不必自己编写模型类型,因为这些类型是基于你 UI 使用的 GraphQL 定义生成的。
由于生成的类型是针对查询的,你只能访问你实际指定为查询部分的数据。如果你没有请求字段,就无法访问相应的属性。实际上,这意味着你现在可以依赖 Swift 类型检查器,确保编译时数据访问中的错误会显示出来。通过我们的 Xcode 集成,你可以方便地将你的 UI 代码和对应的 GraphQL 定义并排使用,它甚至会验证你的查询文档,并在内联显示错误。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Apollo iOS is a strongly-typed, caching GraphQL client, written in Swift.
It allows you to execute queries and mutations against a GraphQL server, and returns results as query-specific Swift types. This means you don’t have to deal with parsing JSON, or passing around dictionaries and making clients cast values to the right type manually. You also don’t have to write model types yourself, because these are generated from the GraphQL definitions your UI uses.
As the generated types are query-specific, you’re only able to access data you actually specify as part of a query. If you don’t ask for a field, you won’t be able to access the corresponding property. In effect, this means you can now rely on the Swift type checker to make sure errors in data access show up at compile time. With our Xcode integration, you can conveniently work with your UI code and corresponding GraphQL definitions side by side, and it will even validate your query documents, and show errors inline.
Apollo iOS does more than simply run your queries against a GraphQL server: It normalizes query results to construct a client-side cache of your data, which is kept up to date as further queries and mutations are run. This means your UI is always internally consistent, and can be kept fully up-to-date with the state on the server with the minimum number of queries required.
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add apollographql/apollo-ios