Files
Swiftgram/submodules/TelegramCore/Sources/ApiUtils/PeerGeoLocation.swift
Isaac 68d60d34dc Refactor Api types 43-52 to use struct-wrapped constructors
Also adds -warnings-as-errors to TelegramCore Package.swift

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 00:33:37 +08:00

21 lines
630 B
Swift

import Foundation
import Postbox
import TelegramApi
extension PeerGeoLocation {
init?(apiLocation: Api.ChannelLocation) {
switch apiLocation {
case let .channelLocation(channelLocationData):
let (geopoint, address) = (channelLocationData.geoPoint, channelLocationData.address)
if case let .geoPoint(_, longitude, latitude, _, _) = geopoint {
self.init(latitude: latitude, longitude: longitude, address: address)
} else {
return nil
}
default:
return nil
}
}
}