GridView

Last updated Oct 19, 2026 A generic grid layout view that arranges child views in a responsive grid. Supports both portrait and landscape orientations with configurable maximum item count.

Initializer parameters

Parameter Type Required Default Description
maxItems UInt ❌ 9 Maximum number of items the grid can display
showingCurrently UInt ✅ - Number of items currently visible in the grid
getChildView @escaping () -> CellContainerView ✅ - Factory closure that creates a new child view for each grid cell

Methods

Method Return Type Description
settingFrames(visibleItemCount:animation:completion:) Void Lays out child views in portrait orientation with optional animation
settingFramesForLandScape(visibleItemCount:animation:completion:) Void Lays out child views in landscape orientation with optional animation
childView(index:) CellContainerView? Returns the child view at the specified index
prepareForReuse(childView:) Void Prepares a child view for reuse

Usage Examples

Basic Usage

import RealtimeKitUI

let gridView = GridView(
    maxItems: 6,
    showingCurrently: 4,
    getChildView: {
        return CellContainerView()
    }
)
view.addSubview(gridView)

Update layout

import RealtimeKitUI

let gridView = GridView(
    maxItems: 9,
    showingCurrently: 3,
    getChildView: {
        return CellContainerView()
    }
)
view.addSubview(gridView)

// Update layout with animation
gridView.settingFrames(
    visibleItemCount: 4,
    animation: true,
    completion: {
        print("Layout updated")
    }
)

Was this helpful?

YesNo

On this page

GridView - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/realtime/realtimekit/humans/ui-kit/api-reference/ios/grid-view/#page","headline":"GridView","description":"API reference for GridView component (iOS Library)","url":"https://developers.cloudflare.com/realtime/realtimekit/humans/ui-kit/api-reference/ios/grid-view/","inLanguage":"en","image":"https://developers.cloudflare.com/realtime/realtimekit/humans/ui-kit/api-reference/ios/grid-view/og.png?v=71dea8fe9899a210","dateModified":"2026-10-19","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: API reference for MeetingViewController component (iOS Library) title: MeetingViewController image: https://developers.cloudflare.com/realtime/realtimekit/humans/ui-kit/api-reference/ios/meeting-view-controller/og.png?v=283830c4ac4c39ad


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/realtime/llms.txt
Use this file to discover all available pages before exploring further.