mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Refactoring
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
|
||||
public extension TelegramEngine.EngineData.Item {
|
||||
enum Notices {
|
||||
public struct Notice: TelegramEngineDataItem, PostboxViewDataItem {
|
||||
public typealias Result = CodableEntry?
|
||||
|
||||
private let entryKey: NoticeEntryKey
|
||||
|
||||
public init(key: NoticeEntryKey) {
|
||||
self.entryKey = key
|
||||
}
|
||||
|
||||
var key: PostboxViewKey {
|
||||
return .notice(key: self.entryKey)
|
||||
}
|
||||
|
||||
func extract(view: PostboxView) -> Result {
|
||||
guard let view = view as? LocalNoticeEntryView else {
|
||||
preconditionFailure()
|
||||
}
|
||||
return view.value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user