How leomehlig/tdlib-ios works
Project type and purpose
• This is not a client app but a reusable Swift library—TDLib-iOS—that wraps Telegram’s native tdlib C++ library and exposes a strongly typed, promise- and stream-based Swift API. It’s designed for Carthage integration and provides code-generation hooks to stay in sync with tdlib’s JSON API.
File structure
• Top-level:
• TDLib.xcodeproj: the Swift framework project
• TDLib/: Swift source: Coordinator, TDJsonClient, Stream, generated API
• TLParser/ + Templates/: Ruby script & stencil templates for Swift code generation
• docs/: Jazzy-generated API documentation
• Cartfile, Gemfile, Travis, SwiftLint, Fastlane: build/test/deploy
• TDLibTests/: unit tests
• Notice the code-generation (TLParser → Templates → TDLib/Generated), the core “Coordinator” facade, the “Stream” observer, and the “TDJsonClient” C++ bridge.
Insights from README
• Coordinator wraps TDJsonClient (C++ → JSON), hides handshake/auth/parameter negotiation, exposes authorizeState streams, send(function) → Promise<Result>.
• Promises (PromiseKit) for single calls, Streams for state updates and downloads.