{"id":20478122,"url":"https://github.com/swiftui-plus/containers","last_synced_at":"2025-04-13T13:13:08.900Z","repository":{"id":43405075,"uuid":"400883846","full_name":"SwiftUI-Plus/Containers","owner":"SwiftUI-Plus","description":"Useful SwiftUI container view's. FittingGeometry, ScrollableView, LayoutReader, PageView, UIKitView. (iOS)","archived":false,"fork":false,"pushed_at":"2022-07-06T21:54:15.000Z","size":24,"stargazers_count":44,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T04:12:35.599Z","etag":null,"topics":["containerview","ios","swift","swiftui"],"latest_commit_sha":null,"homepage":"https://benkau.com/packages.json","language":"Swift","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwiftUI-Plus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-28T20:24:45.000Z","updated_at":"2024-12-03T21:21:49.000Z","dependencies_parsed_at":"2022-07-08T05:10:41.979Z","dependency_job_id":null,"html_url":"https://github.com/SwiftUI-Plus/Containers","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftUI-Plus%2FContainers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftUI-Plus%2FContainers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftUI-Plus%2FContainers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftUI-Plus%2FContainers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwiftUI-Plus","download_url":"https://codeload.github.com/SwiftUI-Plus/Containers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717237,"owners_count":21150389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["containerview","ios","swift","swiftui"],"created_at":"2024-11-15T15:35:15.894Z","updated_at":"2025-04-13T13:13:08.878Z","avatar_url":"https://github.com/SwiftUI-Plus.png","language":"Swift","readme":"![ios](https://img.shields.io/badge/iOS-13-green)\n\n----\n\n\u003e Most of these containers now available as in a single Backports library, with a LOT more additions. This should simply my efforts and allow me and others to contribute more backports in the near future.\n\u003e [SwiftUI Backports](https://github.com/shaps80/SwiftUIBackports)\n\n----\n\n# Containers\n\n\u003e Also available as a part of my [SwiftUI+ Collection](https://benkau.com/packages.json) – just add it to Xcode 13+\n\nUseful SwiftUI container view's for additional convenience.\n\nIncludes:\n\n-   FittingGeometryReader (auto-sizes its height)\n-   ScrollableView (support various contentMode options)\n-   LayoutReader (supports readable and other other guides)\n-   PageView (TabView in paging style but supports auto-sizing)\n-   UIKit View (Easily nest UIView's in SwiftUI, including auto-sizing)\n\n## FittingGeometry\n\nA geometry reader that automatically sizes its height to 'fit' its content.\n\n```swift\nFittingGeometryReader { geo in\n    Text(\"The height is now \\(geo.size.height)\")\n}\n```\n\n## LayoutReader\n\nA container view that provides a layout proxy, allowing you to query various layout properties usually only available via UIKit.\n\nThe most useful example is layout-relative to the `readableContentGuide`\n\n**Features**\n\n-   Familiar API (similar to GeometryReader)\n-   SafeArea, content (layoutMargins) and readable content guide layouts\n-   Responds automatically to dynamic type changes\n-   Respects interface orientation and other layout changes\n\n```swift\nLayoutReader { layout in\n    Rectangle()\n        .foregroundColor(.red)\n        .frame(maxWidth: layout.frame(in: .readable).width)\n}\n```\n\n## ScrollView\n\nA scrollview that behaves more similarly to a `VStack` when its content size is small enough.\n\n```swift\nScrollView(contentMode: .fit) {\n    Text(\"I'm aligned to the top\")\n    Spacer()\n    Text(\"I'm aligned to the bottom, until you scroll ;)\")\n}\n```\n\n## PageView\n\nA page view that behaves similarly to UIPageViewController but adds auto-sizing configuration.\n\n```swift\n// Passing `fit` for the contentMode forces the PageView to hug its content. To fill the available space, set this to `fill` (its default value)\nPageView(selection: $currentPage, contentMode: .fit) {\n    Group {\n        Text(\"Page 1\")\n        Text(\"Page 2\")\n        Text(\"Page 3\")\n    }\n}\n```\n\n\u003e Note: This view requires iOS 14+\n\n## UIKitView\n\nA SwiftUI view that accepts a single UIView instance to be presented in the hierarchy.\n\n```swift\nUIKitView {\n    let label = UILabel(frame: .zero)\n    label.text = \"foo\"\n    return label\n}\n```\n\n## Installation\n\nThe code is packaged as a framework. You can install manually (by copying the files in the `Sources` directory) or using Swift Package Manager (**preferred**)\n\nTo install using Swift Package Manager, add this to the `dependencies` section of your `Package.swift` file:\n\n`.package(url: \"https://github.com/SwiftUI-Plus/Containers.git\", .upToNextMinor(from: \"1.0.0\"))`\n\n## Other Packages\n\nIf you want easy access to this and more packages, add the following collection to your Xcode 13+ configuration:\n\n`https://benkau.com/packages.json`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftui-plus%2Fcontainers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswiftui-plus%2Fcontainers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftui-plus%2Fcontainers/lists"}