A powerful EPG (Electronic Program Guide) UI library for iOS in Swift. Create stunning program guide interfaces with ease.
HPElectronicProgramGuide is a custom collection view designed specifically for creating Electronic Program Guide (EPG) interfaces in iOS applications. It provides a flexible and customizable solution for displaying program guides with channels and their respective programs.
To run the example project, clone the repo, and run pod install
from the Example directory first.
HPElectronicProgramGuide is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'HPElectronicProgramGuide'
let collectionView = HPEpgCollectionView(channelItemSize: CGSize(width: 100, height: 40),
timeItemSize: CGSize(width: 160, height: 40))
collectionView.epgDelegate = self
collectionView.epgDataSource = self
Implement the required methods from the HPEpgCollectionViewDataSource protocol to provide the necessary data for the EPG view:
func cellForFirstItem(at indexPath: IndexPath) -> HPEpgCollectionViewCell
func cellForTimeItem(at timeInterval: Int, indexPath: IndexPath) -> HPEpgCollectionViewCell
func cellForChannelItem(at channelIndex: Int, indexPath: IndexPath) -> HPEpgCollectionViewCell
func cellForProgramItem(at programIndex: Int, inChannel channelIndex: Int, indexPath: IndexPath) -> HPProgramCollectionViewCell
func cellForTimeMarker(at indexPath: IndexPath) -> HPTimeMarkerContainerCell
func numberOfChannel() -> Int
func numberOfProgram(inChannel channelIndex: Int) -> Int
func startSecondOfProgram(at programIndex: Int, inChannel channelIndex: Int) -> Int
func endSecondOfProgram(at programIndex: Int, inChannel channelIndex: Int) -> Int
Implement the required methods from the HPEpgCollectionViewDelegate protocol to handle user interactions with the EPG view:
func didSelectChannel(at index: Int, indexPath: IndexPath)
func didSelectProgram(at index: Int, inChannel channelIndex: Int, indexPath: IndexPath)
func didScrollToTimeRange(from: Int, to: Int)
Customize the collection view cells by subclassing HPEpgCollectionViewCell, HPProgramCollectionViewCell and HPTimeMarkerContainerCell to suit your design needs. Then, registering 5 different cells for Channel, Time Interval, Program, First and Time Marker
collectionView.register(cellClass: ChannelCell.self)
collectionView.register(cellClass: TimeSegmentCell.self)
collectionView.register(cellClass: ProgramCell.self)
collectionView.register(cellClass: FirstCell.self)
collectionView.register(cellClass: TimeMarkerCell.self)
For more detailed information and usage examples, refer to the example project included in this repository.
Contributions are welcome! If you find any issues, have feature requests, or would like to contribute to the project, please feel free to submit a pull request or open an issue.
Hai Pham, [email protected]
HPElectronicProgramGuide is available under the MIT license. See the LICENSE file for more info.