Convert Figma logo to code with AI

overtake logoTelegramSwift

Source code of Telegram for macos on Swift 5.0

4,990
841
4,990
738

Top Related Projects

25,848

Telegram Desktop messaging app

24,740

Telegram for Android source

Telegram-iOS

6,953

Cross-platform library for building Telegram clients

Pure Python 3 MTProto API Telegram client library, for bots too!

Quick Overview

TelegramSwift is an open-source Telegram client for macOS, built entirely in Swift. It aims to provide a native macOS experience for Telegram users, offering a clean and efficient interface while maintaining full compatibility with the Telegram messaging platform.

Pros

  • Native macOS application with a familiar and intuitive user interface
  • Built entirely in Swift, ensuring better performance and integration with macOS
  • Open-source, allowing for community contributions and customizations
  • Regular updates and active development

Cons

  • Limited to macOS platform, not available for other operating systems
  • May lack some features found in the official Telegram desktop client
  • Potential for compatibility issues with future Telegram API changes
  • Smaller user base compared to the official client, which may result in slower bug fixes or feature additions

Code Examples

As TelegramSwift is a full application rather than a code library, there are no specific code examples to provide. The project is meant to be used as a standalone application on macOS.

Getting Started

Since TelegramSwift is an application and not a code library, there's no code-based getting started process. However, here are the steps to get started with using the application:

  1. Visit the TelegramSwift GitHub repository: https://github.com/overtake/TelegramSwift
  2. Download the latest release from the Releases section
  3. Install the application on your macOS system
  4. Launch the application and log in with your Telegram account

Note: As this is a third-party client, use caution and ensure you trust the source before entering your Telegram credentials.

Competitor Comparisons

25,848

Telegram Desktop messaging app

Pros of tdesktop

  • Cross-platform support (Windows, macOS, Linux)
  • More mature and feature-rich desktop client
  • Larger community and more frequent updates

Cons of tdesktop

  • Larger codebase, potentially more complex to contribute to
  • Written in C++, which may have a steeper learning curve for some developers
  • Heavier resource usage compared to Swift-based alternatives

Code Comparison

TelegramSwift (Swift):

func updateChatListFilters() {
    let filters = chatListFilters.filter { $0.id != 0 }
    genericView.tabsView.updateTabs(filters: filters, selected: chatListSelectedIndex)
    genericView.emptyTabsView.isHidden = !filters.isEmpty
}

tdesktop (C++):

void MainWidget::updateDialogsWidthAnimated() {
    if (!_dialogs || _dialogsWidth == _dialogsWidthAnimated) {
        return;
    }
    _dialogsWidthAnimated.start([this] { updateDialogsWidth(); }, _dialogsWidth, st::columnMinimalWidthMain);
}

TelegramSwift focuses on iOS development using Swift, while tdesktop is a cross-platform desktop client written in C++. tdesktop offers broader platform support and a more comprehensive feature set, but may be more complex to work with due to its larger codebase and use of C++. TelegramSwift, being Swift-based, might be more approachable for iOS developers but is limited to Apple platforms.

24,740

Telegram for Android source

Pros of Telegram

  • Written in Java, making it more accessible to a wider range of Android developers
  • More mature and established project with a larger community and contributor base
  • Includes features for both client and server-side implementations

Cons of Telegram

  • Limited to Android platform, lacking cross-platform support
  • May have a steeper learning curve for developers not familiar with Java
  • Potentially slower performance compared to native Swift implementation

Code Comparison

TelegramSwift:

let chat = Chat(peerId: peerId)
let message = Message(text: "Hello, world!")
chat.send(message)

Telegram:

TdApi.Chat chat = new TdApi.Chat(chatId);
TdApi.Message message = new TdApi.Message("Hello, world!");
client.send(new TdApi.SendMessage(chat.id, message));

Both repositories provide implementations of the Telegram messaging protocol, but they target different platforms and use different programming languages. TelegramSwift is focused on iOS and macOS development using Swift, while Telegram is primarily for Android development using Java. The choice between the two would depend on the target platform and the developer's familiarity with the respective programming languages.

Telegram-iOS

Pros of Telegram-iOS

  • Official Telegram client, ensuring full feature support and timely updates
  • Larger community and more active development
  • Better documentation and support resources

Cons of Telegram-iOS

  • More complex codebase, potentially harder for newcomers to contribute
  • Stricter contribution guidelines and review process
  • Larger repository size, which may lead to longer clone and build times

Code Comparison

TelegramSwift:

class ChatListController: ViewController {
    private let chatListInteraction: ChatListInteraction
    
    init(context: AccountContext) {
        self.chatListInteraction = ChatListInteraction(context: context)
        super.init(context: context)
    }
}

Telegram-iOS:

@interface TGDialogListController : TGViewController <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) TGDialogListCompanion *companion;

- (instancetype)initWithCompanion:(TGDialogListCompanion *)companion;

@end

The code comparison shows that TelegramSwift uses Swift and follows a more modern, protocol-oriented approach, while Telegram-iOS uses Objective-C with a traditional delegate pattern. This difference in language and architecture may impact development experience and performance.

6,953

Cross-platform library for building Telegram clients

Pros of td

  • Cross-platform support for multiple programming languages
  • Official Telegram library with direct access to Telegram API
  • More comprehensive and lower-level functionality

Cons of td

  • Steeper learning curve due to C++ core and complex API
  • Requires more setup and configuration compared to Swift-specific libraries
  • May have higher resource usage for simple applications

Code Comparison

TelegramSwift:

let client = TelegramClient(apiId: YOUR_API_ID, apiHash: YOUR_API_HASH)
client.auth.login(phoneNumber: "+1234567890") { result in
    switch result {
    case .success(let user):
        print("Logged in as \(user.firstName)")
    case .failure(let error):
        print("Login failed: \(error)")
    }
}

td:

td::Client client;
td_api::setAuthenticationPhoneNumber request;
request.phone_number_ = "+1234567890";
client.send({1, std::move(request)});
// Handle response in a separate function

Summary

TelegramSwift offers a more Swift-friendly API with easier integration for iOS apps, while td provides a more versatile and powerful solution for cross-platform development. TelegramSwift is better suited for Swift developers focusing on iOS, whereas td is ideal for projects requiring deeper Telegram integration across multiple platforms.

Pure Python 3 MTProto API Telegram client library, for bots too!

Pros of Telethon

  • Written in Python, making it more accessible for a wider range of developers
  • Extensive documentation and active community support
  • Supports both user and bot accounts

Cons of Telethon

  • Limited to Python ecosystem, not suitable for native iOS/macOS development
  • May have slower performance compared to native Swift implementation
  • Requires additional setup for GUI applications

Code Comparison

Telethon (Python):

from telethon import TelegramClient, events

client = TelegramClient('session', api_id, api_hash)

@client.on(events.NewMessage(pattern='/start'))
async def start_handler(event):
    await event.reply('Hello!')

client.start()
client.run_until_disconnected()

TelegramSwift (Swift):

import TelegramSwift

let client = TelegramClient(apiId: apiId, apiHash: apiHash)

client.onNewMessage { message in
    if message.text == "/start" {
        message.reply("Hello!")
    }
}

client.start()
RunLoop.main.run()

Both examples demonstrate basic client setup and message handling, but TelegramSwift's code is more concise and integrated with Swift's syntax. Telethon offers more explicit event handling, while TelegramSwift uses a more callback-oriented approach.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Telegram for macOS

Telegram macOS screenshot

Telegram is a messaging app with a focus on speed and security. It’s superfast, simple, and free! This repo contains the official source code for Telegram for macOS.

Get it

Download on the Mac App Store

Using Homebrew

brew cask install telegram

Using mas-cli

mas install 747648890

Manual download

If you would like, you can download the non-MAS version.

You can also download the beta version if you want to try the latest features and you are prepared for bugs and crashes. If you are running the beta, join the beta testing chat on Telegram to report bugs.

Contributors

Contributors on GitHub

See this repository’s contributors graph.

Bugs and Suggestions

You can report bug or suggestions feature for Telegram for macOS on Telegram’s Bugs & Suggestions platform. Read the platform tip before creating first card.

Translations

You can help translate Telegram for macOS on Telegram’s translations platform. Pick your language, then look for the macOS translation set.

Permissions

Telegram strives to protect your privacy. This app asks for as few permissions as possible:

  • Microphone: You can send voice messages and make audio calls with Telegram.
  • Camera: You can set your profile picture using your Mac’s iSight camera.
  • Location: You can send your location to friends.
  • Outgoing network connections: Telegram needs to connect to the internet to send your messages to your friends.
  • Incoming network connections: Telegram needs to accept incoming connections for peer-to-peer voice calls.
  • User-selected files: You can save files or images to your Mac.
  • Downloads folder: Telegram can automatically download files or images you receive.

Shortcuts

With Shortcuts you can learn how easy is navigate using your devices.

License

Telegram for macOS is licensed under the GNU Public License, version 2.0. See LICENSE for more information.

Forking

You can fork this application and make something awesome! Make sure that your fork follows these five requirements:

  1. Do get your own API ID.
  2. Don’t call your fork Telegram — or at least make sure your users understand that yours is unofficial.
  3. Don’t use our standard logo (white paper plane in a blue circle) for your fork.
  4. Do read and follow our security guidelines to make sure you take good care of your users’ data and protect their privacy.
  5. Do publish your code. The GPL license requires it!

How to Build

Instructions for building Telegram for macOS are in INSTALL.md.