{"id":28709023,"url":"https://github.com/ivan-magda/swiftui-expandable-text","last_synced_at":"2026-02-11T12:23:05.322Z","repository":{"id":293199749,"uuid":"983250775","full_name":"ivan-magda/swiftui-expandable-text","owner":"ivan-magda","description":"A customizable SwiftUI component that provides expandable text with \"Show More\"","archived":false,"fork":false,"pushed_at":"2026-01-12T21:50:56.000Z","size":679,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-13T01:54:54.361Z","etag":null,"topics":["expandable","expandable-text","ios","swift","swiftui"],"latest_commit_sha":null,"homepage":"https://ivan-magda.github.io/swiftui-expandable-text/","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/ivan-magda.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,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-05-14T05:33:27.000Z","updated_at":"2026-01-13T01:39:09.000Z","dependencies_parsed_at":"2025-11-27T12:05:21.811Z","dependency_job_id":null,"html_url":"https://github.com/ivan-magda/swiftui-expandable-text","commit_stats":null,"previous_names":["ivan-magda/swiftui-expandable-text"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/ivan-magda/swiftui-expandable-text","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-magda%2Fswiftui-expandable-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-magda%2Fswiftui-expandable-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-magda%2Fswiftui-expandable-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-magda%2Fswiftui-expandable-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivan-magda","download_url":"https://codeload.github.com/ivan-magda/swiftui-expandable-text/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-magda%2Fswiftui-expandable-text/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28473974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T22:27:41.514Z","status":"ssl_error","status_checked_at":"2026-01-15T21:54:47.910Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["expandable","expandable-text","ios","swift","swiftui"],"created_at":"2025-06-14T19:39:31.638Z","updated_at":"2026-02-11T12:23:05.313Z","avatar_url":"https://github.com/ivan-magda.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExpandableText\n\n[![Swift](https://github.com/ivan-magda/swiftui-expandable-text/actions/workflows/swift.yml/badge.svg)](https://github.com/username/swiftui-expandable-text/actions/workflows/swift.yml)\n[![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-brightgreen.svg)](https://swift.org/package-manager/)\n[![Swift 6.0](https://img.shields.io/badge/Swift-6.0-orange.svg)](https://swift.org)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n[![Platform](https://img.shields.io/badge/platform-iOS%20|%20macOS%20|%20tvOS%20|%20watchOS-lightgrey.svg)](https://developer.apple.com/swift)\n\nDrop-in SwiftUI text that expands on tap. Markdown, animations, RTL-handled.\n\n\u003cp align=\"leading\"\u003e\n  \u003cimg src=\"demo/expandable-text-demo.gif\" width=\"240\" alt=\"ExpandableText Demo\"\u003e\u0026nbsp;\u0026nbsp;\u003cimg src=\"demo/markdown-demo.gif\" width=\"240\" alt=\"Markdown Demo\"\u003e\u0026nbsp;\u0026nbsp;\u003cimg src=\"demo/customization-demo.gif\" width=\"240\" alt=\"Customization Demo\"\u003e\n\u003c/p\u003e\n\n## Features\n\n- Markdown rendering support (**bold**, *italic*, ~~strikethrough~~, `code`, [links](url))\n- Expand text with customizable animation\n- Automatically detects text truncation\n- Customizable \"more\" button text, style, and font\n- Supports various text styling options\n- Works across iOS, macOS, tvOS, and watchOS\n- Smooth gradient truncation effect\n- RTL language support\n\n## Requirements\n\n- iOS 15.0+ / macOS 12.0+ / tvOS 15.0+ / watchOS 8.0+\n- Swift 6.0+\n- Xcode 16.2+\n\n## Installation\n\n### Swift Package Manager\n\nAdd the following to your `Package.swift` file:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/ivan-magda/swiftui-expandable-text.git\", from: \"2.0.0\")\n]\n```\n\nOr add it directly through Xcode:\n1. Go to **File** \u003e **Add Package Dependencies...**\n2. Enter the repository URL: `https://github.com/ivan-magda/swiftui-expandable-text.git`\n3. Follow the prompts to complete the installation\n\n## Usage\n\n### Basic Usage\n\n```swift\nimport SwiftUI\nimport ExpandableText\n\nstruct ContentView: View {\n    var body: some View {\n        ExpandableText(\"Lorem ipsum dolor sit amet, consectetur adipiscing elit...\")\n            .padding()\n    }\n}\n```\n\n### Markdown Support\n\nString literals automatically render markdown:\n\n```swift\nExpandableText(\"This is **bold**, *italic*, and ~~strikethrough~~ text. Visit [Apple](https://apple.com) for more.\")\n```\n\nFor string variables or to disable markdown parsing, use `verbatim:`:\n\n```swift\nlet text = fetchedContent // String variable\nExpandableText(verbatim: text)\n```\n\n### Customization\n\n```swift\nExpandableText(longText)\n    .font(.body)\n    .foregroundStyle(.primary)\n    .lineLimit(3)\n    .moreButtonText(\"Show more\")\n    .moreButtonFont(.caption.bold())\n    .moreButtonForegroundStyle(.blue)\n    .expandAnimation(.easeOut)\n```\n\n## Available Modifiers\n\n| Modifier | Description | Default |\n|----------|-------------|---------|\n| `font(_:)` | Sets the font for the text | `.body` |\n| `foregroundStyle(_:)` | Sets the text color | `.primary` |\n| `lineLimit(_:)` | Sets maximum number of lines when collapsed | `3` |\n| `moreButtonText(_:)` | Text for the \"show more\" button | `\"more\"` |\n| `moreButtonFont(_:)` | Font for the \"show more\" button | Same as text font |\n| `moreButtonForegroundStyle(_:)` | Shape style for the \"show more\" button | `.accentColor` |\n| `expandAnimation(_:)` | Animation used when expanding/collapsing | `.spring` |\n\n## How It Works\n\nThe `ExpandableText` component works by:\n\n1. Measuring both the truncated and full-size text\n2. Detecting if truncation is necessary\n3. Applying a gradient mask to create a smooth fade effect\n4. Adding a \"show more\" button when text is truncated\n5. Expanding/collapsing with animation when the button is tapped\n\n## Advanced Example\n\n```swift\nstruct BlogPostView: View {\n    let post: BlogPost\n\n    var body: some View {\n        VStack(alignment: .leading, spacing: 12) {\n            Text(post.title)\n                .font(.title)\n                .bold()\n\n            Text(\"Posted by \\(post.author) • \\(post.dateFormatted)\")\n                .font(.caption)\n                .foregroundColor(.secondary)\n\n            ExpandableText(verbatim: post.content)\n                .font(.body)\n                .foregroundStyle(.primary)\n                .lineLimit(4)\n                .moreButtonText(\"Read more\")\n                .moreButtonFont(.caption.bold())\n                .moreButtonForegroundStyle(.blue)\n                .padding(.vertical, 4)\n\n            Divider()\n        }\n        .padding()\n    }\n}\n```\n\n## Documentation\n\nFull API documentation available at [Swift Package Index](https://swiftpackageindex.com/ivan-magda/swiftui-expandable-text/main/documentation/expandabletext).\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the project\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\nIvan Magda - [@ivanmagda](https://github.com/ivanmagda)\n\n## Acknowledgments\n\n- Inspired by the need for a more customizable text expansion solution in SwiftUI\n- Thanks to the SwiftUI community for support and feedback\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivan-magda%2Fswiftui-expandable-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivan-magda%2Fswiftui-expandable-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivan-magda%2Fswiftui-expandable-text/lists"}