{"id":13420636,"url":"https://github.com/cfdrake/swift-framework-c-library-example","last_synced_at":"2025-03-15T07:31:18.269Z","repository":{"id":147368360,"uuid":"43704838","full_name":"cfdrake/swift-framework-c-library-example","owner":"cfdrake","description":"Example of a simple Swift framework that integrates with a C library without bridging headers.","archived":false,"fork":false,"pushed_at":"2017-06-17T18:54:24.000Z","size":134,"stargazers_count":68,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-07-31T22:56:07.161Z","etag":null,"topics":["playground","swift","tutorial"],"latest_commit_sha":null,"homepage":"https://colindrake.me/post/wrapping-a-c-library-in-a-swift-framework/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cfdrake.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-10-05T18:25:20.000Z","updated_at":"2024-05-13T01:09:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"2b2d933a-e17e-45de-91ff-000643ca7064","html_url":"https://github.com/cfdrake/swift-framework-c-library-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfdrake%2Fswift-framework-c-library-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfdrake%2Fswift-framework-c-library-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfdrake%2Fswift-framework-c-library-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfdrake%2Fswift-framework-c-library-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cfdrake","download_url":"https://codeload.github.com/cfdrake/swift-framework-c-library-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243701016,"owners_count":20333614,"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":["playground","swift","tutorial"],"created_at":"2024-07-30T22:01:37.960Z","updated_at":"2025-03-15T07:31:17.946Z","avatar_url":"https://github.com/cfdrake.png","language":"C","readme":"# Swift Progress Bar Framework\nThis is the code example from my blog article: [Wrapping a C Library in a Swift Framework](https://colindrake.me/post/wrapping-a-c-library-in-a-swift-framework/). To see the creation of this project from the beginning to end, feel free to read the post!\n\nIf you like this, feel free to check out [my site](http://colindrake.me)!\n\n## Motivation\n[Bridging Headers](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) are the recommended way of including C, C++, and Objective-C code in your Swift projects. However, the compiler does not allow you do this for Framework targets, which is a problem if you wish to create a Framework that wraps a C library.\n\nThis repository is an example of how to create a Swift framework that is able to call out to a C library without using Bridging Headers. Instead, it uses Clang [Module Mapping](http://clang.llvm.org/docs/Modules.html#module-maps).\n\n## Example Framework\nThe `Progressbar` framework is exported by this example project. It includes one class: `Progressbar`.\n\nThe `Progressbar` class has one initializer that takes two required parameters: `text` and `max`, the text to display and the maximum value of the progress bar.\n\nEach `Progressbar` instance responds to two methods: `increment` and `finish`. `increment` bumps up (and animates) the progress bar by one unit. `finish` completes the bar and finishes drawing.\n\n## Example Framework Usage\nThe Xcode project contains an Xcode Playground demonstrating usage of the module. You should see a progress bar animating over the course of 30 seconds once you open this file. If you don't see it, press **⌘-Shift-Y** to ensure that the Console window is showing.\n\n## Dependencies/Thanks\n[progressbar](https://github.com/doches/progressbar) is the C library that is wrapped in this example project. The source is included with this git repository. Thanks to the [original author](https://github.com/doches) for providing a simple library to wrap!\n","funding_links":[],"categories":["TODO scan for Android support in followings"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfdrake%2Fswift-framework-c-library-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcfdrake%2Fswift-framework-c-library-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfdrake%2Fswift-framework-c-library-example/lists"}