All Projects β†’ cfdrake β†’ Swift Framework C Library Example

cfdrake / Swift Framework C Library Example

Example of a simple Swift framework that integrates with a C library without bridging headers.

Programming Languages

c
50402 projects - #5 most used programming language
swift
15916 projects

Projects that are alternatives of or similar to Swift Framework C Library Example

Graphql Editor
πŸ“Ί Visual Editor & GraphQL IDE. Draw GraphQL schemas using visual πŸ”· nodes and explore GraphQL API with beautiful UI. Even πŸ’ can do that!
Stars: ✭ 5,485 (+8606.35%)
Mutual labels:  tutorial, playground
Gistlyn
Run Roslyn Gists
Stars: ✭ 75 (+19.05%)
Mutual labels:  tutorial, playground
Phoenix Ecto Append Only Log Example
πŸ“ A step-by-step example/tutorial showing how to build a Phoenix (Elixir) App where all data is immutable (append only). Precursor to Blockchain, IPFS or Solid!
Stars: ✭ 58 (-7.94%)
Mutual labels:  tutorial
Carc.in
Compile & run code in
Stars: ✭ 62 (-1.59%)
Mutual labels:  playground
Django Auth Tutorial Example
Django Authentication Video Tutorial
Stars: ✭ 60 (-4.76%)
Mutual labels:  tutorial
Tutorial Quickstart
πŸŽ“ Tutorial Quick Start: official intro to Nette Framework by creating blog.
Stars: ✭ 58 (-7.94%)
Mutual labels:  tutorial
Aspnetboilerplate Core Ng
Tutorial for ASP.NET Boilerplate Core + Angular
Stars: ✭ 61 (-3.17%)
Mutual labels:  tutorial
Flask Tutorial
A tutorial to build your first flask application
Stars: ✭ 58 (-7.94%)
Mutual labels:  tutorial
Flexbox30
Learn Flexbox in 30 days with 30 code tidbits ✨
Stars: ✭ 1,127 (+1688.89%)
Mutual labels:  tutorial
Sinais
πŸ”£ Desenvolvimento passo a passo do exemplo `sinais` em Go.
Stars: ✭ 59 (-6.35%)
Mutual labels:  tutorial
Bytepath
A replayable arcade shooter with a focus on build theorycrafting made using Lua and LΓ–VE.
Stars: ✭ 1,119 (+1676.19%)
Mutual labels:  tutorial
Dyci Main
Dynamic Code Injection Tool for Objective-C
Stars: ✭ 1,103 (+1650.79%)
Mutual labels:  playground
Hooking Template With Mod Menu
A small template for Android Hooking with Substrate. (Includes a mod menu written in Java)
Stars: ✭ 59 (-6.35%)
Mutual labels:  tutorial
Ionic Google Login
Ionic 4 starter app to show you how to add Google Log In to an Ionic App using Google Sign-In Cordova Plugin.
Stars: ✭ 61 (-3.17%)
Mutual labels:  tutorial
Opensource.guide
πŸ“š Community guides for open source creators
Stars: ✭ 9,460 (+14915.87%)
Mutual labels:  tutorial
React Native Hole View
βœ‚οΈ React-Native component to cut a touch-through holes anywhere you want. Perfect solution for tutorial overlay
Stars: ✭ 61 (-3.17%)
Mutual labels:  tutorial
Regex In Python
A comprehensive guide for learning regular expressions using Python
Stars: ✭ 58 (-7.94%)
Mutual labels:  tutorial
Id.javascript.info
Tutorial JavaScript Modern dalam Bahasa Indonesia
Stars: ✭ 59 (-6.35%)
Mutual labels:  tutorial
Netmap Tutorial
Netmap tutorial at SIGCOMM 2017 and AsiaBSDCon 2018
Stars: ✭ 60 (-4.76%)
Mutual labels:  tutorial
Generate Pages Tutorial
ζ•™δ½ δΈ€ζ­₯ζ­₯δ»Žι›Άζž„ε»Ί webpack εΌ€ε‘ε€šι‘΅ι’ηŽ―ε’ƒ
Stars: ✭ 63 (+0%)
Mutual labels:  tutorial

Swift Progress Bar Framework

This is the code example from my blog article: 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!

If you like this, feel free to check out my site!

Motivation

Bridging Headers 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.

This 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.

Example Framework

The Progressbar framework is exported by this example project. It includes one class: Progressbar.

The 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.

Each 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.

Example Framework Usage

The 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.

Dependencies/Thanks

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 for providing a simple library to wrap!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].