Swift for Android, Kotlin for iOS
Summary
TLDRThe script discusses the evolution of cross-platform development, highlighting how Swift and Kotlin are revolutionizing native app creation for multiple platforms without code changes. It emphasizes the advantages of native tooling over frameworks like Flutter, React Native, and Electron, which may compromise developer or user experience. The video showcases how Google and Apple's efforts have made Swift and Kotlin developer-friendly, enabling the creation of consistent, high-quality apps across iOS, Android, Windows, Mac OS, and Linux, ushering in a renaissance of software engineering.
Takeaways
- đ± Swift applications can run on Android devices without code changes, utilizing native material components during the build process.
- đ Cross-platform development is evolving, making it easier to create native applications for multiple platforms with native tooling.
- đ ïž Kotlin is the language used for Android development, and its UI framework, Compose, can now build native Swift UI applications using existing Kotlin code.
- đ€ Compose allows for code reusability across platforms without the need for rewriting, embedding the view controller into a V app.
- đ§ There are tools like Skip that facilitate cross-platform development by translating Swift code to Kotlin Compose code, although it's proprietary and can be unstable.
- đ Rattle is an open-source toolchain that helps share logic between Swift and Android projects, requiring UI layer rewriting for Android.
- đ Both Google and Apple have invested heavily in developer experience, creating dedicated IDEs, emulators, and powerful APIs for their platforms.
- đ Kotlin and Swift are developer-friendly languages, making them excellent choices for mobile app development.
- đš Swift UI and Material UI provide consistent design languages across applications, enhancing the user experience.
- đ» Beyond mobile, the same codebase can be used for desktop apps, with Windows supporting Swift through specific bindings.
- đ Compose supports cross-platform development for mobile and desktop, including Linux, allowing for shared or platform-specific code in Kotlin.
- đ The current landscape of software engineering offers a renaissance of opportunities for developers to create delightful apps with improved developer and user experiences.
Q & A
What is the significance of the Swift application running on an Android device without code changes?
-The significance lies in the demonstration of cross-platform capabilities, where an application originally developed for iOS can run on Android with no modifications, showcasing the potential for shared codebases across different operating systems.
What does the term 'Native material components' refer to in the context of the script?
-Native material components refer to the native user interface elements that are specific to the Android platform, which are being used to convert the iOS application into a format compatible with Android.
Why is the ability to create cross-platform native applications considered a game-changer in the development landscape?
-The ability to create cross-platform native applications without additional developer work or abstraction layers simplifies the development process, reduces costs, and allows developers to reach a wider audience with a single codebase.
What is the role of 'Cotlin' in Android development mentioned in the script?
-Cotlin is a programming language used for Android development. It is highlighted for its UI framework, Compose, which has been extended to build native Swift UI applications using existing Kotlin code.
How does the script suggest using Kotlin Compose for cross-platform development?
-The script suggests that Kotlin Compose can be used to create applications that run natively on iOS devices by calling Kotlin Compose code directly and embedding it into the view controller.
What is the 'Skip' plugin mentioned in the script, and what does it do?
-The 'Skip' plugin is a tool that allows developers to pass Swift code and produce matching Kotlin Compose code. It enables cross-platform development by facilitating the use of Swift in Android applications, although it is proprietary and may have limitations.
What is the 'Rattle' toolchain, and how does it help in sharing logic between iOS and Android projects?
-The 'Rattle' toolchain is a set of open-sourced tools developed by a company called 'Rle' that helps share common logic between iOS and Android projects while allowing the UI layer to be rewritten specifically for Android.
Why is the script critical of third-party cross-platform development tools like Flutter, React Native, and Ionic?
-The script criticizes these tools for either providing a worse developer experience or resulting in a worse user experience when compared to native tooling. It suggests that the advantages of these tools in reducing cross-platform development work are diminishing as native tooling improves.
How does the script describe the developer experience with Swift and Kotlin?
-The script describes the developer experience with Swift and Kotlin as pleasant and developer-friendly, highlighting the effort put by Apple and Google to create dedicated IDEs, emulators, and powerful APIs to enhance the development process.
What is the script's stance on the user experience provided by native platforms compared to third-party tools?
-The script asserts that native platforms provide the best user experience due to consistent design languages and homogeneous application interfaces, whereas third-party tools create a middle ground that may compromise the user experience.
What is the potential of using a single codebase for multiple platforms, including desktop and mobile, as discussed in the script?
-The script suggests that with advancements in native tooling, it is now feasible to use a single codebase for multiple platforms, including iOS, Android, Windows, macOS, and potentially Linux, allowing for a more efficient and unified development process.
Outlines
đ± Cross-Platform Native App Development with Swift and Compose
The script discusses the evolution of cross-platform app development, highlighting how Swift and Compose enable developers to create native applications for iOS and Android without code changes. It emphasizes the maturity of these ecosystems, which now allow for the development of native applications with native tooling, without the need for additional developer work or abstraction layers. The script also touches on the disadvantages of third-party cross-platform solutions like Flutter, React Native, and Ionic, which may compromise the developer and user experience. It introduces 'Cotland', a language for Android development, and its UI framework 'Compose', which can now build native Swift UI applications using existing code. The script also mentions 'Skip', a plugin for converting Swift code to Compose code, and 'Buckle', a toolchain for sharing logic between Swift and Android projects.
đ Expanding Cross-Platform Development Beyond Mobile
This paragraph expands on the idea of cross-platform development, suggesting that the same codebase can be used not only for mobile apps but also for desktop applications across various platforms including Windows, Mac OS, and Linux. It mentions the 'Browser Company' and their efforts to recreate WinUI components in Swift, allowing for the development of Windows applications using Swift. The paragraph also discusses the limitations of Flutter, positioning it as a middle ground that doesn't fully leverage the design language and consistency of established platforms. The script concludes by celebrating the current state of software engineering, where developers have a plethora of tools to turn ideas into delightful apps, and encourages the use of native tooling for the best developer and user experience.
Mindmap
Keywords
đĄSwift
đĄAndroid
đĄXcode
đĄCross-platform development
đĄCotlin
đĄCompose
đĄNative UI
đĄFlutter
đĄReact Native
đĄRattle
đĄMaterial UI
Highlights
Swift applications can run on Android devices with no code changes, thanks to the conversion to native material components during the Xcode build process.
Google's sample project creates native Swift UI without third-party dependencies, allowing for cross-platform applications with no additional developer work or abstraction layers.
The cross-platform development landscape is evolving, making it easier to create native applications with native tooling.
Cotlin is used for Android development, and its UI framework, Compose, can now build native Swift UI applications using existing Kotlin code.
Apple's ecosystem is more closed than Google's, but there are still options for cross-platform development with Swift.
Skip is a proprietary plugin that translates Swift code to Kotlin Compose code, though it may not be as stable or comprehensive.
Rattle is an open-source toolchain that helps share logic between Swift and Android projects, with separate UI layers for each platform.
Google and Apple have invested heavily in developer experience, creating dedicated IDEs, emulators, and powerful APIs like Kotlin and Swift.
Swift UI and Material UI are significant for providing a consistent design language and user experience across applications on their respective platforms.
Flutter offers a middle ground in cross-platform development but may compromise the native experience compared to using native tools.
It's possible to write a single codebase for iOS and Android and extend it to desktop apps, as demonstrated by the Windows version of a Swift application.
Swift can be used with specific bindings to create different UIs for various platforms, allowing for shared application logic.
Compose, a tool from the Compose team, enables cross-platform applications for mobile and desktop, including Linux, using native tools.
The Todo app example by the Compose team demonstrates the ability to run on multiple platforms with shared or platform-specific code.
Native tooling with Kotlin and Swift has significantly improved the developer experience and the way programming languages are perceived.
The current state of software engineering represents a renaissance, with the developer and user experience being better than ever before.
There is a wide range of tools available for turning ideas into delightful apps, and the choice of tooling impacts the experience for both developers and users.
Transcripts
this is a swift application running on
an Android device with no code changes
this xcode sample project made by Apple
is being converted to Native material
components for Android as part of the
xcode build process and this is a
cotland application running on iOS also
with no code changes this Google sample
project creates native Swift UI with no
third party
dependencies both of these projects are
shipping native cross platform
applications without any additional
developer work or abstraction layers the
crossplatform development landscape is
changing as these ecosystems have
matured it's now easier than ever to
create cross-platform native
applications with Native tooling and
it's not just mobile stick around and
I'll show you how to maintain a single
native code base while building an
application for iOS Android Windows Mac
OS and Linux flutter react native ionic
and electron all either have a worse
developer experience or result in a
worse user experience when compared to
Native tooling previously these
disadvantages were outweighed by the
advantage of Haring the amount of work
required for cross-platform development
but that won't Remain the case for long
a lot of smart people and influential
companies are working hard to make the
portable native codebase dream a reality
cotland is the language used for Android
development the UI framework for cotland
is called compose historically it's been
used to create Android and desktop
applications but they recently added the
capability to build native Swift UI
applications using existing cin code
this is an example of a composed
application running on an iOS device
although this looks like a pretty normal
xcode project when I go into this view
controller I can see that it's calling
cotland compost code directly and
embedding The View controller into V app
letting me reuse it without rewriting
it if you prefer using Swift over cotlin
you are also in luck but since apple is
inherently more closed than Google the
tools aren't integrated directly into
the ecosystem but you still have a few
options for crossplatform development
skip is a plug-in that will pass Swift
Code and produce matching colon compos
code this particular solution is
proprietary and will often break since
all apis are not implemented I look
forward to an open-source more stable
implement of something similar I
couldn't find an example of a skip
application online so all I did is go to
the sample applications on the Apple
website and downloaded the first example
here about me then I created a brand new
xcode project using Skip and then copied
all the files over when I run build
inside of xcode it'll run the app both
on Android and iOS and we can see that
we're using native UI for both of
these a more consistent option for
existing Swift applications is using a
set of tools to share common logic
between IOS and Android projects while
rewriting the UI layer for Android this
effort is spearheaded by a company
called rle who has open- sourced many
tools that help share logic between
Swift and Android projects this is an
example weather app made using the
rattle tool chain I can't run it because
this particular tool chain doesn't work
on macoma but we can still look at the
files and see how it works I have three
folders that are important here the core
one is the logic which is written in
Swift and is shared for Android and iOS
then there's separate folders for the
Swift UI and for Android as you can see
the core of the application is written
in Swift there's not a lot to it here
it's just an API that calls for wether
data and then we have a separate xcode
project that includes for UI for iOS and
Mac OS and then another project which
has the UI for Android it's a little bit
of extra work but it gives you more
customizability Google and apple have
put a ridiculous amount of effort to
make the developer experience on their
platforms as pleasant as possible they
stand to gain everything from having the
best possible apps on their devices
they've both created dedicated idees and
emulators with purpose-built programming
languages and powerful apis cotland and
Swift are two of the most developer
friendly languages out there and I would
know I tried a ton of them either of Eco
systems make an excellent envir
environment to create mobile apps it's
been such a tragedy that in the past we
would need to throw it all away in the
name of better crossplatform development
the ability to build crossplatform apps
with either of these ecosystems is a
huge deal and that future is closer than
ever before for both of these platforms
Apple and Google have put a lot of work
into the user experience on their
platforms the design language is
consistent and homogeneous across
different applications the benefits of
Swift UI and material UI should not be
underestimated I don't know if you
remember a time when all apps weren't
just web app rappers but native apps
feel so much better flutter fits
somewhere in the middle of both of these
ecosystems and creates its own
abstraction layer both for developer and
the user miss out on the design language
and consistency of these very
established platforms only native
platforms can provide the best
experience for both developers and users
and look I don't want to rag on fluted
too much I know people really like it
but compared to this it feels like a
middle ground where everyone has
compromised and no one really gets what
they want if you go native you know at
least one set of users is getting the
best possible experience and the other
is getting a translation layer that's
comparable with what they would have
with flutter anyway but why stop there
if we can already write a single code
base for IOS and Android why not go
further and use the same code base for
your desktop apps as well the browser
company recently released a Windows
version of their Swift application by
recreating winui components in Swift you
can share application logic between all
platforms but use Swift with specific
bindings to create different uis this is
the windows sample app provided by the
browser company that shows how to use
Swift to create Windows applications as
you can see this is all written in Swift
but they import the Win app SDK Windows
foundation and wiui to call these apis
directly from within Swift allowing us
to write Swift but ship on Windows since
the browser company hasn't had a need
for Linux or Android yet there are no
bindings for those platforms but these
projects are open source so it's only a
matter of time if you want to write a
crossplatform application for mobile and
desktop including Linux using native
tools today your best bet is the first
tool covered in this video cotlin
compose compose does more than code
generation it uses application binary
interfaces to call cotlin code in other
Lang anges directly the team have
created bindings for all major platforms
so compost can actually run anywhere
even embedded systems this is an example
of an app that runs everywhere the
composed team provide this Todo app that
can run on all platforms you can have as
much shared or platform specific code as
you want to and it's all cotlin and it's
all composed we can run on Android iOS
Mac OS windows and even Linux
clearly I enjoy using native tooling
cotland and Swift have honestly changed
the way I think about programming
languages they are just so pleasant but
whatever tooling you do use whether it
is native development or flut or react
native or Progressive web apps the
developer and user experience across all
tooling is better than it has ever been
before we are so lucky to be a part of
this Renaissance in software engineering
there has never been a better time to
turn your awesome idea into a delightful
app whatever tool you use I can't wait
to see what you create
5.0 / 5 (0 votes)