Skip to content

release v0.1.

Choose a tag to compare

@zendrx zendrx released this 11 Jun 14:25
· 23 commits to main since this release

First Public Release

native.cr is a framework for building native mobile applications using the Crystal language. Write your app logic once in Crystal. Deploy to Android. Run on desktop during development.

Features

Core Framework

  • Native::App base class with state preservation
  • UI components: View, Text, Button, Image, Column, Row, Container
  • Styling system with colors, fonts, themes, edge insets, corner radius
  • Touch events and gesture handling
  • Animation system with curves (linear, ease-in, ease-out, bounce, elastic)
  • Math utilities: Vector2, Vector3, Rect, Matrix3, Color

Platform Support

  • Android: Full support via JNI + NDK
  • Desktop: Development preview via SDL2
  • iOS: Coming soon (requires Mac with Xcode)

Modules

  • Network (HTTP client, WebSocket)
  • Storage (Preferences, FileStorage, SQLite)
  • Audio (Sound playback, Music streaming, Recording)
  • Camera (Photo capture, Video recording, Preview)
  • Notifications (Local and push notifications)
  • Permissions (Runtime permission handling)
  • Biometric (Fingerprint, Face ID)
  • Payments (In-app purchases)
  • Game Loop (Fixed, Variable, Adaptive timestep)
  • Location (GPS, Geocoding)
  • Sensors (Accelerometer, Gyroscope, Magnetometer, Light, Proximity)
  • Connectivity (Network status, WiFi, Cellular)
  • Image Picker (Camera, Gallery)
  • Clipboard (Copy, Paste)
  • Share (Text, URL, Image)

UI Components (15+)

  • TextView, EditText, Button, ImageView
  • ProgressBar, SeekBar, Switch, CheckBox, RadioButton
  • Spinner, RecyclerView, WebView, CardView
  • LinearLayout, ScrollView, Icon

CLI Commands

  • native.cr create - Create new project
  • native.cr build android - Build APK
  • native.cr reload - Desktop preview with fast restart
  • native.cr doctor - Check toolchain installation

Installation

Add to your shard.yml:

dependencies:
  native:
    github: slick-lab/native.cr
    version: ~> 0.1.0

Then run:

shards install

Quick Start

# Create a new project
native.cr create my_app
cd my_app

# Build for Android
native.cr build android

# Desktop preview
native.cr reload src/main.cr

Example

include Native

class MyApp < Native::App
  @[Preserve]
  property count : Int32 = 0

  def setup : Nil
    @label = Text.new
    @label.text = "Tap: 0"
    @label.text_size = 24

    button = Button.new
    button.text = "Tap Me"
    button.on_click = ->{ increment }

    column = Column.new
    column.spacing = 20
    column.add_child(@label)
    column.add_child(button)

    @root = column
  end

  def increment : Nil
    @count += 1
    @label.text = "Tap: #{@count}"
  end
end

Native::App.start(MyApp)

Requirements

  • Crystal 1.20+
  • Android NDK r25+ (for Android builds)
  • Android SDK (for APK packaging)

Documentation

Acknowledgments

  • Crystal Language Team
  • Android NDK Team
  • SDL2 Community
  • Open Source Contributors

License

MIT


Built with frustration. Released with love.