Skip to content

Commit

Permalink
Create StaticCollectionView SwiftUI View (#615)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamede1945 authored Dec 29, 2023
1 parent 4535f8f commit 355b66c
Show file tree
Hide file tree
Showing 3 changed files with 446 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ public class QuranTranslationDiffableDataSource {
section.contentInsets = .zero
section.interGroupSpacing = 0

let collectionViewLayout: UICollectionViewCompositionalLayout
let collectionView: UICollectionView
section.contentInsetsReference = .none
collectionViewLayout = UICollectionViewCompositionalLayout(section: section)
collectionView = UICollectionView(frame: .zero, collectionViewLayout: collectionViewLayout)
let collectionViewLayout = UICollectionViewCompositionalLayout(section: section)
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: collectionViewLayout)

collectionView.backgroundColor = .clear
collectionView.contentInsetAdjustmentBehavior = .never
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// HostingTableViewCell.swift
// HostingCell.swift
// Quran
//
// Created by Afifi, Mohamed on 11/26/20.
Expand Down Expand Up @@ -76,3 +76,16 @@ public final class HostingTableViewCell<Content: View>: UITableViewCell {

private lazy var hostingController = ViewHostingController<Content?>(view: self, contentView: contentView)
}

@available(iOS 13.0, *)
public final class HostingCollectionViewCell<Content: View>: UICollectionViewCell {
// MARK: Public

public func set(rootView: Content, parentController: UIViewController) {
hostingController.set(rootView: rootView, parentController: parentController)
}

// MARK: Private

private lazy var hostingController = ViewHostingController<Content?>(view: self, contentView: contentView)
}
Loading

0 comments on commit 355b66c

Please sign in to comment.