Coder Social home page Coder Social logo

Swift support about componentkit HOT 21 CLOSED

Fab1n avatar Fab1n commented on April 24, 2024 21
Swift support

from componentkit.

Comments (21)

eczarny avatar eczarny commented on April 24, 2024 6

@zackshapiro I believe much of what @darknoon talks about from his comment in 2015 still applies here, unfortunately. Last I checked Swift still doesn't work with Objective-C++ and implementing a pure Objective-C wrapper API would take considerable effort.

/cc @ocrickard

from componentkit.

darknoon avatar darknoon commented on April 24, 2024 3

Hey, it's probably fair to give an explanation of why this isn't going to happen in the short term:

Without ObjC++ interoperability in Swift it will be really hard to make this work well. ObjC++ and Swift are pretty similar, but have incompatible object models. It would take a lot of work to make C++ compatibility happen in Swift: until we have an elegant interoperation mode at the compiler level, we can’t support Swift in this ObjC++ framework.

I'm interested in what features of Swift this community is excited about, and see what we can do to help bring those ideas to ComponentKit-based apps. Many of the nice things we love about Swift are already in C++. It, like Swift, is in active development—C++14 and C++17 has many new features. For example, a proposal for async/await like in c#/hack.

So, here’s what it would take to support Swift today with the existing compiler landscape: wrap all of the C++ code in pure ObjC. This undermines the elegance we have with CKComponentViewConfiguration etc where you can declare things inline, and degrade performance by creating a bunch more ObjC objects.

I think the best way to achieve what you're looking for would be to port the ideas from ComponentKit / React over to Swift. We're happy to help with any questions you might have in doing that, but it's not on our priority list right now since there is so much to do improving ComponentKit as an ObjC++ framework. For instance, I recently worked on memoization for components and layouts (using some cool C++ features), which should make ComponentKit even more efficient and scale to really hard UI problems.

I think the closest thing to what you guys are looking for is Few.swift. My understanding is that it's still pretty early on and not ready for production, but you should contribute!

One final thing I'll mention is AsyncDisplayKit, which is compatible with Swift: https://github.com/facebook/asyncdisplaykit. There are some features like stack layouts similar to ComponentKit there, though it's closer to UIKit than React. It trades off the easy updates inherent in the React model for easier UIView manipulation and gestures.

Hope that helps, and sorry to be bringer of bad news… :/

from componentkit.

leavez avatar leavez commented on April 24, 2024 1

Hey guys, I write a wrapper of componentKit for swift, ComponentSwift. Please have a try if interested.

from componentkit.

Isuru-Nanayakkara avatar Isuru-Nanayakkara commented on April 24, 2024

+1 for Swift support. I think they even mentioned something about porting it to Swift in the @scale talk. I'm not sure.

from componentkit.

Fab1n avatar Fab1n commented on April 24, 2024

sure, they mentioned it. That's why I wrote this issue for :). Peek to the last minute of the video of the talk and you hear the swift mention.

from componentkit.

nheagy avatar nheagy commented on April 24, 2024

Adam mentioned swift is on hold for a bit on twitter: https://twitter.com/adamjernst/status/580955735456010242

I think C++ have some important similarities as far as API design goes, so even though a swift/objC wrapper is probably not viable the final API should be very familiar.

from componentkit.

modocache avatar modocache commented on April 24, 2024

I'm super interested in exploring using ComponentKit from Swift! It should be possible by building an intermediate bridging layer in Objective-C. I'd love to see some proof-of-concepts--maybe submit a pull request?

from componentkit.

grp avatar grp commented on April 24, 2024

I think @arigrant looked into what a Swift API might look like, could be a good starting place before writing an implementation/bridge.

from componentkit.

adamjernst avatar adamjernst commented on April 24, 2024

I should also mention Few.swift as a project that's already exploring a reactive model in Swift. It's not asynchronous and is still experimental, but I think it's promising.

from componentkit.

danscan avatar danscan commented on April 24, 2024

Any update on this? To be able to use ComponentKit with Swift would be HUGE.

from componentkit.

S0r13n avatar S0r13n commented on April 24, 2024

+1 for Swift support.

from componentkit.

metabren avatar metabren commented on April 24, 2024

+1

from componentkit.

schickling avatar schickling commented on April 24, 2024

👍

from componentkit.

3a4oT avatar 3a4oT commented on April 24, 2024

+1

from componentkit.

choidamdam avatar choidamdam commented on April 24, 2024

+1

from componentkit.

sdduursma avatar sdduursma commented on April 24, 2024

+1

from componentkit.

jlnbuiles avatar jlnbuiles commented on April 24, 2024

+1

from componentkit.

anton-matosov avatar anton-matosov commented on April 24, 2024

+1

from componentkit.

 avatar commented on April 24, 2024

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

from componentkit.

Adlai-Holler avatar Adlai-Holler commented on April 24, 2024

+1

from componentkit.

zackshapiro avatar zackshapiro commented on April 24, 2024

Any updates on Swift support for ComponentKit?

from componentkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.