Signal-iOS/SignalUI/ViewControllers/OWSTableView/OWSTableContents.swift
Igor Solomennikov 2b43b1fef9
Convert OWSTableViewController and related classes to Swift.
Also convert OWSTableContents, OWSTableSection and OWSTableItem to Swift.

The only subclass of OWSTableViewController was DebugUITableViewController which has to be converted to Swift as well.

I also changed OWSTableViewController to be a subclass of OWSViewController (more modern and all in Swift) instead of OWSViewControllerObjc.
2023-05-08 19:33:03 -07:00

41 lines
951 B
Swift

//
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//
import Foundation
@objc
public class OWSTableContents: NSObject {
public private(set) var title: String?
@objc
public private(set) var sections: [OWSTableSection] = []
@objc
public var sectionForSectionIndexTitleBlock: ((String, Int) -> Int)?
@objc
public var sectionIndexTitlesForTableViewBlock: (() -> [String])?
public init(title: String? = nil, sections: [OWSTableSection] = []) {
self.title = title
self.sections = sections
super.init()
}
public convenience override init() {
self.init(title: nil, sections: [])
}
@objc
public func addSection(_ section: OWSTableSection) {
sections.append(section)
}
public func addSections<T: Sequence>(_ sections: T) where T.Element == OWSTableSection {
self.sections.append(contentsOf: sections)
}
}