Comments (1)
Looks like no update is necessary. This library can be used also in pure Kotlin projects.
Gradle will require to use 2 more plugins for kotlin:
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
also kotlin dependency implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
, but most of this will be done by AndroidStudio automatically.
The only problem is that annotated fields have to be public or package-protected which is kind of problematic to achieve in Kotlin. I found 2 ways:
1) lateinit
modifier:
@Inject
lateinit var presenter: MyPresenter
This can be used for @Inject
or @Arg/@Extra
fields, but it's not a good idea for @State
.
Primitive types and nullables cannot be assigned with lateinit
, which is very limiting.
2) @JvmField
annotation:
@State
@JvmField
var text: String = ""
This can be used for all Blade annotations.
It supports primitive types, nullables and you can also define a default value for the field.
(The only downside is that it makes the field public and not package-protected as I would like.)
If you know any better way for this or have some other questions/problems regarding Blade compatibility with Kotlin, please write it here and I'll open this issue again.
from blade.
Related Issues (19)
- There is no I.startMyActivity() generated if there is no @Extra annotation in the class. HOT 1
- Support for Parceler HOT 1
- Possible improvement? HOT 6
- Multiple annotations HOT 7
- Kotlin support HOT 4
- Inject code for @State at the end of `onSaveInstanceState()` HOT 1
- Support also yaml config file HOT 1
- Butterknife 8.4.0 does not work with Blade. HOT 4
- How to pass List as Extra? HOT 5
- Generate assertions from standard Android annotations HOT 2
- NoClassDefFoundError: javax/inject/Inject HOT 3
- Support for com.android.tools.build:gradle:3.+ HOT 1
- Add method for Bundle creation to blade.F
- Combine modules arg and extra into one
- Support for MVVM
- Kotlin primitive is generated as private HOT 4
- Only Fragment subclass can contain @Arg with AndroidX HOT 5
- Error for gradle 4.x HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blade.