{"id":13465801,"url":"https://github.com/C4Labs/C4iOS","last_synced_at":"2025-03-25T16:32:53.210Z","repository":{"id":2498305,"uuid":"3472786","full_name":"C4Labs/C4iOS","owner":"C4Labs","description":"C4 is an open-source creative coding framework that harnesses the power of native iOS programming with a simplified API that gets you working with media right away. Build artworks, design interfaces and explore new possibilities working with media and interaction.","archived":false,"fork":false,"pushed_at":"2021-02-07T16:04:43.000Z","size":68123,"stargazers_count":980,"open_issues_count":18,"forks_count":74,"subscribers_count":50,"default_branch":"master","last_synced_at":"2025-03-19T18:38:27.619Z","etag":null,"topics":["creative-coding","swift","uikit"],"latest_commit_sha":null,"homepage":"www.c4ios.com","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/C4Labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-02-17T18:48:04.000Z","updated_at":"2025-03-03T00:17:54.000Z","dependencies_parsed_at":"2022-11-28T10:33:51.121Z","dependency_job_id":null,"html_url":"https://github.com/C4Labs/C4iOS","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/C4Labs%2FC4iOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/C4Labs%2FC4iOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/C4Labs%2FC4iOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/C4Labs%2FC4iOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/C4Labs","download_url":"https://codeload.github.com/C4Labs/C4iOS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245500486,"owners_count":20625589,"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":["creative-coding","swift","uikit"],"created_at":"2024-07-31T15:00:35.668Z","updated_at":"2025-03-25T16:32:52.549Z","avatar_url":"https://github.com/C4Labs.png","language":"Swift","readme":"![C4](http://www.c4ios.com/images/c4logo.png)\n\n# Code, Creatively.\n\nC4 is an open-source creative coding framework that harnesses the power of native iOS programming with a simplified API that gets you working with media right away. Build artworks, design interfaces and explore new possibilities working with media and interaction.\n\nBuilt on top of Swift, C4 puts the power of UIKit and Core Animation at your disposal, allowing you to create inventive digital interactions with far less time and effort. Plus, you get all the interactivity, fun and expressiveness of Swift. Your apps will run lightning-fast.\n\nThe API of C4 is simple and streamlined allowing beginners to get into programming very easily. For seasoned developers, C4 can be dropped into any existing project with as little effort as linking any other native framework. With C4, you’ll save a ton of time when working with interactions, animation and media.\n\n## Expressive\n\nC4 brings your ideas to life by allowing you to focus on experimenting, designing, visualizing and building rather than on learning low-level technologies. Objects are consistent and intuitive—they all essentially work the same way. C4's language has been designed to be as simple and expressive as possible.\n\nFor example, C4 compresses the access of properties:\n\n```swift\nlet m = movie.width\n```\n\nInstead of this:\n\n```swift\nlet m = movie.frame.size.width\n```\n\nAnimating both view and property changes in C4 is much cleaner, and looks like this:\n\n```swift\nViewAnimation(duration: 0.5) {\n  shape.center = self.canvas.center\n  shape.lineWidth = 5\n}.animate()\n```\n\nWhereas using UIKit + Core Animation you'd have to do something like this:\n\n```swift\nUIView.animate(withDuration: 0.5) {\n    v.center = self.view.center\n}\n\nCATransaction.begin()\nCATransaction.setValue(0.5, forKey: kCATransactionAnimationDuration)\nif let shapeLayer = v.layer as? CAShapeLayer {\n    shapeLayer.lineWidth = 5\n}\nCATransaction.commit()\n```\n\nC4 takes advantage of all of Swift’s modernity: closures, tuples, generics, interaction, structs, error handling. And, YES, you can even do this:\n\n```swift\nlet bananaName = \"Jimmy\".banana\n```\n\nCheck the [Swift Overview](https://developer.apple.com/swift/) for more.\n\n## Easy To Learn\n\nThrough both its simplified API and consistent objects, C4 is incredibly easy to learn compared to the frameworks it’s built upon: UIKit, Core Animation, etc. C4’s language has been designed to make it easy for both novice and experienced programmers to pick up and use right away.\n\n## Well Supported\n\nThe C4 team has always been highly committed to publishing excellent documentation, examples and tutorials for learning how to program with C4.\n\nThe current release of C4 also includes a full end-to-end tutorial that will walk you through the design, creation and publication of a full-blown app: COSMOS\n\n[Get COSMOS from the App Store](https://itunes.apple.com/us/app/c4smos/id985883701?ls=1\u0026mt=8)\n\n[Build COSMOS from start to finish](http://www.c4ios.com/cosmos) \n\nWe’re currently converting over 200 code examples and 30 tutorials to C4's new modern syntax. These examples and tutorials (coming soon) guide new users through core concepts and provide seasoned developers with the reference they need to keep up the pace.\n\n## Powerful\n\nOriginally based on Objective-C, C4 now takes entire advantage of the Swift programming language — which itself was built to be fast and powerful. Where Swift has been tuned to make intuitive, natural coding perform best, the guts of each component in C4 — every class, every method and every structure –  make that performance sing.\n\nThrough C4 you are able to work with media, animations and interactions in a way that dissolves the differences between the many frameworks you need to create beautiful user experiences. It seamlessly combines many important components of UIKit, Core Animation, Core Graphics, AVFoundation and QuartzCore.\n\n## Multipurpose\n\nC4 is built for anyone who wants to build beautiful user experiences for iOS and has been designed to reach an incredibly broad set of possible uses. This flexibility is one of the most important aspects of C4, demonstrating its strength across a variety of different use cases and disciplines.\n\nC4 has been used for:\n\n- Prototyping\n- Mobile Applications\n- Data Visualization\n- Interactive Artworks\n- Computational Design Education\n- Communication Design\n- Print Design\n\n## Simplicity\n\nSimplicity is a major accomplishment for C4. Across the board, C4 is simple to learn, to use, to read and to adopt. C4 reduces the amount of code you need to the most powerful essentials.\n\nTake movies, for example. Instead of needing to AVQueuePlayer, AVPlayerItem, navigating asset tracks and learning how to load files through NSBundle, you only have to create a movie from its file name and add it to the canvas:\n\n```swift\nfunc setup() {\n  let movie = Movie(\"halo.mp4\")\n  canvas.add(movie)\n  movie?.play()\n}\n```\n\nUsing UIKit + AVFoundation, you'd have to construct the movie object from scratch like this:\n\n```swift\nfunc viewDidLoad() {\n  guard let url = Bundle.main.url(forResource: \"halo.mp4\", withExtension: nil) else {\n      fatalError(\"File not found\")\n  }\n\n  let asset = AVAsset(url: url)\n  let player = AVQueuePlayer(playerItem: AVPlayerItem(asset: asset))\n  player.actionAtItemEnd = .pause\n\n  let movieLayer = AVPlayerLayer(player: player)\n  movieLayer.videoGravity = .resize\n\n  let tracks = asset.tracks(withMediaType: .video)\n\n  let movieTrack = tracks[0]\n  let size = movieTrack.naturalSize\n\n  movieLayer.frame = CGRect(x: 0,y: 0,width: size.width,height: size.height)\n  self.view.layer.addSublayer(movieLayer)\n  player.play()\n}\n```\n\n… And a whole lot more.\n\n\n## Open Source\n\nC4 is an open-source project licensed under the [MIT License](https://en.wikipedia.org/wiki/MIT_License). It can be used freely in educational, artistic and even professional settings. The project is open to anyone who wants to contribute, and the project’s code, documentation, and process are completely available for you to read through, learn from and take advantage of. Ongoing commitment by our core team and other developers guarantees that C4 will be constantly updated and focused on user’s interests.\n\n### Contributing\n\nThere are many ways to contribute to C4 and we really appreciate any contributions. It can be anything from better documentation to a brand new feature. To get started take a look at our [Contribution Guidelines](CONTRIBUTING.md).\n\n### Community\n\nJoin our [Slack channel](https://join-c4.herokuapp.com/) to ask for help, show off your app, suggest change, or just chat.\n\n","funding_links":[],"categories":["Libs","Kit [🔝](#readme)","Swift"],"sub_categories":["Kit"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FC4Labs%2FC4iOS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FC4Labs%2FC4iOS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FC4Labs%2FC4iOS/lists"}