Convert Figma logo to code with AI

TelegramMessenger logoTelegram-iOS

Telegram-iOS

5,898
1,568
5,898
503

Top Related Projects

24,740

Telegram for Android source

Source code of Telegram for macos on Swift 5.0

Telegram-iOS

6,441

telegram-cli

6,953

Cross-platform library for building Telegram clients

Quick Overview

The TelegramMessenger/Telegram-iOS repository contains the source code for the official Telegram messaging app for iOS devices. It's an open-source project that allows developers to examine, contribute to, and build their own version of the Telegram client for Apple's mobile platform.

Pros

  • Open-source, allowing for transparency and community contributions
  • Highly secure messaging platform with end-to-end encryption
  • Feature-rich, including voice and video calls, file sharing, and custom stickers
  • Regular updates and active development

Cons

  • Complex codebase that may be challenging for newcomers to navigate
  • Requires Apple Developer account and Xcode to build and run
  • Some features may be tightly coupled with Telegram's backend services
  • Limited customization options compared to third-party clients

Code Examples

As this is a full application repository rather than a code library, specific code examples are not applicable. However, developers can explore the source code to understand how various features are implemented.

Getting Started

To get started with the Telegram-iOS project:

  1. Clone the repository:

    git clone https://github.com/TelegramMessenger/Telegram-iOS.git
    
  2. Install the required dependencies:

    cd Telegram-iOS
    sh ./build-system/make/build.sh --arch arm64 --configuration release
    
  3. Open the Telegram-iOS.xcworkspace file in Xcode.

  4. Set up your Apple Developer account in Xcode and configure the necessary provisioning profiles.

  5. Build and run the project on your iOS device or simulator.

Note: You may need to adjust certain build settings or resolve dependencies based on your specific development environment and the current state of the project.

Competitor Comparisons

24,740

Telegram for Android source

Pros of Telegram

  • Open-source Android client, allowing for community contributions and audits
  • More frequent updates and commits, potentially leading to faster feature implementation
  • Larger community of contributors, which may result in diverse perspectives and improvements

Cons of Telegram

  • Less official support compared to the iOS version, as it's not maintained by Telegram directly
  • Potential for inconsistencies with the official iOS app in terms of features and design
  • May have more bugs or stability issues due to community-driven development

Code Comparison

Telegram (Android):

public class MessageObject {
    public TLRPC.Message messageOwner;
    public CharSequence messageText;
    public int type;
    public int messageId;
    // ... more properties and methods
}

Telegram-iOS:

public final class Message: Equatable {
    public let id: Int32
    public let flags: Int32
    public let peerId: PeerId
    public let timestamp: Int32
    // ... more properties and methods
}

The Android version uses a more Java-centric approach with a single class containing various properties, while the iOS version follows Swift conventions with a more structured and type-safe implementation.

Source code of Telegram for macos on Swift 5.0

Pros of TelegramSwift

  • Written in Swift, providing better performance and safety features
  • More modern codebase, potentially easier to maintain and extend
  • Smaller repository size, possibly indicating a more focused and efficient implementation

Cons of TelegramSwift

  • Less official support and updates compared to the official Telegram-iOS repository
  • Potentially missing some features or optimizations present in the official app
  • May have compatibility issues with future Telegram API changes

Code Comparison

TelegramSwift:

func presentationData(theme: PresentationTheme? = nil, strings: PresentationStrings? = nil, dateTimeFormat: PresentationDateTimeFormat? = nil, nameDisplayOrder: PresentationPersonNameOrder? = nil, disableAnimations: Bool? = nil, largeEmoji: Bool? = nil, chatMode: PresentationChatMode? = nil) -> PresentationData {
    // Implementation
}

Telegram-iOS:

- (void)updateThemeAndStrings {
    [self updateTheme:[self generateTheme]];
    [self updateStrings:[self generatePresentationStrings]];
    [self updateDateTimeFormat:[self generateDateTimeFormat]];
    // Additional implementation
}

The code comparison shows that TelegramSwift uses Swift's more modern syntax and type system, while Telegram-iOS uses Objective-C. This difference in language choice affects the overall structure and readability of the codebase.

Telegram-iOS

Pros of Telegram-iOS

  • Open-source nature allows for community contributions and transparency
  • Regularly updated with new features and security improvements
  • Comprehensive documentation for developers

Cons of Telegram-iOS

  • Large codebase may be challenging for new contributors to navigate
  • Requires significant resources to build and run locally
  • Some features may be platform-specific and not available on all iOS devices

Code Comparison

Both repositories contain the same codebase, as they are the same project. Here's a sample of the Swift code used in the Telegram-iOS app:

import Foundation
import SwiftSignalKit
import Postbox

public final class TelegramEngine {
    public let account: Account
    
    public init(account: Account) {
        self.account = account
    }
}

This code snippet demonstrates the initialization of the TelegramEngine class, which is a core component of the Telegram-iOS app. It imports necessary modules and sets up the account property.

Since both repositories are identical, there are no differences in the codebase to compare. The Telegram-iOS project is a single, unified repository for the iOS version of the Telegram messaging app.

6,441

telegram-cli

Pros of tg

  • Written in C, potentially offering better performance and lower resource usage
  • Command-line interface allows for more flexibility and scripting capabilities
  • Supports multiple accounts and session management

Cons of tg

  • Less user-friendly for non-technical users compared to the official iOS app
  • Limited graphical interface and multimedia features
  • May lack some of the latest Telegram features and updates

Code Comparison

tg (CLI-based approach):

void send_message (peer_id_t id, const char *text) {
  clear_packet ();
  out_int (CODE_messages_send_message);
  out_peer_id (id);
  out_string (text);
  out_long (0);
  send_packet ();
}

Telegram-iOS (UI-driven approach):

func sendMessage(text: String, to peerId: PeerId) {
    let message = EnqueueMessage.message(text: text, attributes: [])
    let _ = enqueueMessages(account: self.account, peerId: peerId, messages: [message])
}

The tg repository uses a lower-level C implementation for sending messages, while Telegram-iOS employs Swift with higher-level abstractions and integration with the iOS UI framework.

6,953

Cross-platform library for building Telegram clients

Pros of td

  • Cross-platform library, supporting multiple programming languages
  • More flexible and customizable for developers building Telegram clients
  • Provides lower-level access to Telegram API functionality

Cons of td

  • Requires more development effort to create a full-featured client
  • Less user-friendly for non-developers or those seeking a ready-to-use solution
  • May have a steeper learning curve compared to Telegram-iOS

Code Comparison

td (C++):

auto send_message = td_api::make_object<td_api::sendMessage>();
send_message->chat_id_ = chat_id;
send_message->input_message_content_ = td_api::make_object<td_api::inputMessageText>();
send_message->input_message_content_->as_input_message_text()->text_ = td_api::make_object<td_api::formattedText>();
send_message->input_message_content_->as_input_message_text()->text_->text_ = "Hello, World!";
send_query(std::move(send_message), {});

Telegram-iOS (Swift):

let params = SendMessageParams(chatId: chatId, text: "Hello, World!")
let signal = context.engine.messages.sendMessage(params)
signal.start(next: { result in
    print("Message sent successfully")
})

The td library provides more granular control over message composition and sending, while Telegram-iOS offers a more abstracted and simplified approach tailored for iOS development. td's flexibility comes at the cost of increased complexity, whereas Telegram-iOS provides a more streamlined experience for iOS-specific development.

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 iOS Source Code Compilation Guide

We welcome all developers to use our API and source code to create applications on our platform. There are several things we require from all developers for the moment.

Creating your Telegram Application

  1. Obtain your own api_id for your application.
  2. Please do not use the name Telegram for your app — or make sure your users understand that it is unofficial.
  3. Kindly do not use our standard logo (white paper plane in a blue circle) as your app's logo.
  4. Please study our security guidelines and take good care of your users' data and privacy.
  5. Please remember to publish your code too in order to comply with the licences.

Quick Compilation Guide

Get the Code

git clone --recursive -j8 https://github.com/TelegramMessenger/Telegram-iOS.git

Setup Xcode

Install Xcode (directly from https://developer.apple.com/download/applications or using the App Store).

Adjust Configuration

  1. Generate a random identifier:
openssl rand -hex 8
  1. Create a new Xcode project. Use Telegram as the Product Name. Use org.{identifier from step 1} as the Organization Identifier.
  2. Open Keychain Access and navigate to Certificates. Locate Apple Development: your@email.address (XXXXXXXXXX) and double tap the certificate. Under Details, locate Organizational Unit. This is the Team ID.
  3. Edit build-system/template_minimal_development_configuration.json. Use data from the previous steps.

Generate an Xcode project

python3 build-system/Make/Make.py \
    --cacheDir="$HOME/telegram-bazel-cache" \
    generateProject \
    --configurationPath=build-system/template_minimal_development_configuration.json \
    --xcodeManagedCodesigning

Advanced Compilation Guide

Xcode

  1. Copy and edit build-system/appstore-configuration.json.
  2. Copy build-system/fake-codesigning. Create and download provisioning profiles, using the profiles folder as a reference for the entitlements.
  3. Generate an Xcode project:
python3 build-system/Make/Make.py \
    --cacheDir="$HOME/telegram-bazel-cache" \
    generateProject \
    --configurationPath=configuration_from_step_1.json \
    --codesigningInformationPath=directory_from_step_2

IPA

  1. Repeat the steps from the previous section. Use distribution provisioning profiles.
  2. Run:
python3 build-system/Make/Make.py \
    --cacheDir="$HOME/telegram-bazel-cache" \
    build \
    --configurationPath=...see previous section... \
    --codesigningInformationPath=...see previous section... \
    --buildNumber=100001 \
    --configuration=release_arm64

FAQ

Xcode is stuck at "build-request.json not updated yet"

Occasionally, you might observe the following message in your build log:

"/Users/xxx/Library/Developer/Xcode/DerivedData/Telegram-xxx/Build/Intermediates.noindex/XCBuildData/xxx.xcbuilddata/build-request.json" not updated yet, waiting...

Should this occur, simply cancel the ongoing build and initiate a new one.

Telegram_xcodeproj: no such package

Following a system restart, the auto-generated Xcode project might encounter a build failure accompanied by this error:

ERROR: Skipping '@rules_xcodeproj_generated//generator/Telegram/Telegram_xcodeproj:Telegram_xcodeproj': no such package '@rules_xcodeproj_generated//generator/Telegram/Telegram_xcodeproj': BUILD file not found in directory 'generator/Telegram/Telegram_xcodeproj' of external repository @rules_xcodeproj_generated. Add a BUILD file to a directory to mark it as a package.

If you encounter this issue, re-run the project generation steps in the README.

Tips

Codesigning is not required for simulator-only builds

Add --disableProvisioningProfiles:

python3 build-system/Make/Make.py \
    --cacheDir="$HOME/telegram-bazel-cache" \
    generateProject \
    --configurationPath=path-to-configuration.json \
    --codesigningInformationPath=path-to-provisioning-data \
    --disableProvisioningProfiles

Versions

Each release is built using a specific Xcode version (see versions.json). The helper script checks the versions of the installed software and reports an error if they don't match the ones specified in versions.json. It is possible to bypass these checks:

python3 build-system/Make/Make.py --overrideXcodeVersion build ... # Don't check the version of Xcode