{"id":25516189,"url":"https://github.com/ipedro/swiftui-property-picker","last_synced_at":"2026-02-10T09:05:32.928Z","repository":{"id":227320744,"uuid":"761679717","full_name":"ipedro/swiftui-property-picker","owner":"ipedro","description":"A framework for dynamically selecting and applying view properties.","archived":false,"fork":false,"pushed_at":"2025-11-03T23:17:37.000Z","size":381,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-04T01:10:54.394Z","etag":null,"topics":["picker","picker-library","swiftui"],"latest_commit_sha":null,"homepage":"https://ipedro.github.io/swiftui-property-picker/","language":"Swift","has_issues":true,"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/ipedro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-22T09:34:44.000Z","updated_at":"2025-11-03T23:14:03.000Z","dependencies_parsed_at":"2024-05-17T11:48:47.262Z","dependency_job_id":"cb4d4e6e-c79d-4dd8-97e7-b3f5b5c7e50d","html_url":"https://github.com/ipedro/swiftui-property-picker","commit_stats":null,"previous_names":["ipedro/swiftui-property-picker"],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/ipedro/swiftui-property-picker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipedro%2Fswiftui-property-picker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipedro%2Fswiftui-property-picker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipedro%2Fswiftui-property-picker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipedro%2Fswiftui-property-picker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipedro","download_url":"https://codeload.github.com/ipedro/swiftui-property-picker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipedro%2Fswiftui-property-picker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29295417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T03:42:42.660Z","status":"ssl_error","status_checked_at":"2026-02-10T03:42:41.897Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["picker","picker-library","swiftui"],"created_at":"2025-02-19T14:18:17.511Z","updated_at":"2026-02-10T09:05:32.899Z","avatar_url":"https://github.com/ipedro.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftUI Property Picker\n\n[![Swift Versions](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fipedro%2Fswiftui-property-picker%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/ipedro/swiftui-property-picker)\n[![Supported Platforms](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fipedro%2Fswiftui-property-picker%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/ipedro/swiftui-property-picker)\n![License](https://img.shields.io/badge/License-MIT-blue.svg)\n![SPM Compatible](https://img.shields.io/badge/Swift_Package_Manager-compatible-brightgreen.svg)\n\nThe `swiftui-property-picker` is a comprehensive SwiftUI package designed to enhance dynamic property selection and application within your SwiftUI views. By leveraging the power of property pickers, you can offer a richer, more interactive user experience that adapts on the fly.\n\n## Features\n\n- **Dynamic Property Selection**: Enable views to adjust their properties dynamically based on user selection or other criteria.\n- **Flexible Configuration**: Easily configure property pickers to use state, environment values, or custom binding for dynamic updates.\n- **Customizable Presentation Styles**: Choose from multiple presentation styles for your pickers, or define your own for full control over the UI.\n- **Streamlined Integration**: Designed for ease of use, the package can be seamlessly integrated into any SwiftUI project to enhance its dynamic capabilities.\n\n## Installation\n\n### Swift Package Manager\n\nAdd `swiftui-property-picker` to your project by including it in your `Package.swift` file:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/ipedro/swiftui-property-picker\", .upToNextMajor(from: \"3.0.0\"))\n]\n```\n\nThen, import `swiftui-property-picker` in your SwiftUI views to start using it.\n\n## Documentation\n\nThe full documentation for `swiftui-property-inspector` can be found [here](https://ipedro.github.io/swiftui-property-picker/documentation/propertypicker/).\n\n## Usage\n\nHere's how to get started with the SwiftUI Property Picker:\n\n### Basic Usage\n\nTo apply a dynamic property picker to a view, use one of the `propertyPicker()` view modifiers provided by the extension on `View`. Here are some examples:\n\n```swift\nimport SwiftUI\nimport PropertyPicker\n\n@available(iOS 16.4, *)\nstruct ExampleSheet: View {\n    // This key keeps a local state\n    @PropertyPicker(ContentKey.self)\n    private var content\n\n    // This key writes the selection value directly in the SwiftUI environment\n    @PropertyPicker(\\.isEnabled, InteractionKey.self)\n    private var interaction\n\n    // This key also writes the selection value directly in the SwiftUI environment\n    @PropertyPicker(\\.colorScheme, ColorSchemeKey.self)\n    private var colorScheme\n\n    @State private var presented = false\n\n    var body: some View {\n        PropertyPickerReader(isPresented: $presented) {\n            Button {\n                presented.toggle()\n            } label: {\n                switch content {\n                case .Image:\n                    Image(systemName: \"circle\")\n                case .Text:\n                    Text(\"Button\")\n                }\n            }\n            .buttonStyle(.bordered)\n            .propertyPicker($interaction)\n            .propertyPicker($colorScheme)\n            .propertyPicker($content)\n        }\n    }\n}\n\nenum ContentKey: String, PropertyPickerKey {\n    case Text, Image\n}\n\nenum InteractionKey: String, PropertyPickerKey {\n    static var defaultValue: InteractionKey = .Enabled\n    case Disabled, Enabled\n\n    var value: Bool {\n        switch self {\n        case .Disabled: false\n        case .Enabled: true\n        }\n    }\n}\n\nenum ColorSchemeKey: String, PropertyPickerKey {\n    case Light, Dark\n\n    var value: ColorScheme {\n        switch self {\n        case .Light: .light\n        case .Dark: .dark\n        }\n    }\n}\n```\n\n### Defining Property Picker Keys\n\nImplement the `PropertyPickerKey` protocol to define the keys used for selecting properties. Here's an example:\n\n```swift\nenum YourPickerKey: String, PropertyPickerKey {\n    case optionOne = \"Option One\"\n    case optionTwo = \"Option Two\"\n    \n    static var defaultValue: Self { .optionOne }\n    \n    var value: SomeType {\n        switch self {\n        case .optionOne: return .someValue\n        case .optionTwo: return .anotherValue\n        }\n    }\n}\n```\n\n#### Using PropertyPicker\n\n```swift\nimport SwiftUI\nimport PropertyPicker\n\nstruct ContentView: View {\n    @PropertyPicker\u003cYourPickerKey\u003e\n    private var myValue\n    \n    var body: some View {\n        YourView(value: myValue)\n            .propertyPicker($myValue)\n    }\n}\n```\n\n#### Using PropertyPickerEnvironment\n\n```swift\nimport SwiftUI\nimport PropertyPicker\n\nstruct ContentView: View {\n    @PropertyPicker(YourPickerKey.self, \\.myEnvironmentValue)\n    private var myEnvironmentValue\n    \n    var body: some View {\n        YourView().propertyPicker($myEnvironmentValue)\n    }\n}\n```\n\nor\n\n```swift\nimport SwiftUI\nimport PropertyPicker\n\nstruct ContentView: View {\n    var body: some View {\n        YourView().propertyPicker(YourPickerKey.self, \\.myEnvironmentValue)\n    }\n}\n```\n\n### Customizing Picker Styles\n\nYou can customize the presentation of your property pickers by applying different styles:\n\n```swift\n.propertyPickerStyle(.inline) // For inline presentation\n.propertyPickerStyle(.contextMenu) // For context menu presentation\n.propertyPickerStyle(.sheet(isPresented: $isSheetPresented)) // For sheet presentation\n```\n\n### Advanced Customization\n\n#### Using `PropertyPicker` for Local State Management\n\nThe `PropertyPicker` property wrapper can be used to manage a local state that dynamically updates based on user selection. Here's an example demonstrating its usage:\n\n```swift\nimport SwiftUI\nimport PropertyPicker\n\nstruct DynamicFontSizeView: View {\n    @PropertyPicker\u003cFontSizeKey\u003e\n    private var fontSize\n    \n    var body: some View {\n        Text(\"Adjustable Font Size\")\n            .font(.system(size: fontSize))\n            .propertyPicker($fontSize)\n    }\n}\n\nenum FontSizeKey: String, PropertyPickerKey {\n    case small, medium, large\n    \n    static var defaultValue: Self { .medium }\n    \n    var value: CGFloat {\n        switch self {\n        case .small: return 12\n        case .medium: return 16\n        case .large: return 20\n        }\n    }\n}\n```\n\n#### Using `PropertyPickerEnvironment` for Environment Value Adjustments\n\nThe `PropertyPickerEnvironment` property wrapper enables the adjustment of environment values directly. Here's how you can use it to modify the environment's `ColorScheme`:\n\n```swift\nimport SwiftUI\nimport PropertyPicker\n\nstruct ThemeSwitcherView: View {\n    var body: some View {\n        VStack {\n            Text(\"Theme Switcher\")\n            Toggle(isOn: .constant(true)) {\n                Text(\"Dark Mode\")\n            }\n            .propertyPicker(ColorSchemeKey.self, \\.colorScheme)\n        }\n    }\n}\n\nenum ColorSchemeKey: String, PropertyPickerKey {\n    case light, dark\n    \n    static var defaultValue: Self { .light }\n    \n    var value: ColorScheme {\n        switch self {\n        case .light: return .light\n        case .dark: return .dark\n        }\n    }\n}\n```\n\n#### Using Bindings Directly with `PropertyPicker`\n\nFor direct manipulation of view properties through bindings, the `propertyPicker` modifier can be utilized as follows:\n\n```swift\nimport SwiftUI\nimport PropertyPicker\n\nstruct ContentView: View {\n    @State private var isButtonDisabled: Bool = false\n    \n    var body: some View {\n        Button(action: {}) {\n            Text(\"Button\")\n        }\n        .disabled(isButtonDisabled)\n        .propertyPicker(DisabledStateKey.self, $isButtonDisabled)\n    }\n}\n\nenum DisabledStateKey: String, PropertyPickerKey {\n    case enabled, disabled\n    \n    static var defaultValue: Self { .enabled }\n    \n    var value: Bool {\n        switch self {\n        case .enabled: return false\n        case .disabled: return true\n        }\n    }\n}\n```\n\n#### Customizing Picker Presentation with `PropertyPickerStyle`\n\nApply custom styles to modify how property pickers are presented in the UI. The following example demonstrates using the `.sheet` style:\n\n```swift\nimport SwiftUI\nimport PropertyPicker\n\nstruct CustomizedPickerView: View {\n    @State private var isPickerPresented: Bool = false\n    \n    var body: some View {\n        VStack {\n            Text(\"Customized Picker Presentation\")\n            Button(\"Show Picker\") {\n                isPickerPresented = true\n            }\n        }\n        .propertyPickerStyle(_SheetPropertyPicker(isPresented: $isPickerPresented))\n    }\n}\n```\n\nThese examples should provide a comprehensive understanding of how to leverage the various capabilities of the `swiftui-property-picker` package. By incorporating these dynamic and customizable property pickers into your SwiftUI views, you can create more interactive and responsive applications.\n\n## Contributing\n\nWe welcome contributions! If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.\n\n## License\n\nThe `swiftui-property-picker` package is released under the MIT License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipedro%2Fswiftui-property-picker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipedro%2Fswiftui-property-picker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipedro%2Fswiftui-property-picker/lists"}