Skip to content

RbBtSn0w/RBSOdometer

Repository files navigation

RBSOdometer

CI Status License Platform Language

RBSOdometer is an Objective-C library for smoothly animating number transitions with customizable effects, perfect for displaying changing numerical values with visual appeal.

Features

  • 🎯 Smooth number transition animations
  • ⚡ Customizable animation duration and density
  • 🎨 Configurable text color and font
  • 📱 Auto Layout support
  • 🔄 Efficient view reuse with RBSReuseQueue
  • 🛠️ Easy to integrate and use

Demo

Requirements

  • iOS 11.0+
  • Xcode 15.0+
  • Tuist (for project generation)

Installation

Using Tuist (Recommended)

  1. Install Tuist using Mise (recommended):
# Install Mise
curl https://mise.run | sh

# Install Tuist
mise use tuist@4.0.0

Or install via Homebrew (note: may install a newer version):

brew install tuist
  1. Add RBSOdometer to your Dependencies.swift:
import ProjectDescription

let dependencies = Dependencies(
    swiftPackageManager: SwiftPackageManagerDependencies([
        .remote(
            url: "https://github.com/RbBtSn0w/RBSOdometer.git",
            requirement: .upToNextMajor(from: "0.2.0")
        )
    ])
)
  1. Add as a dependency in your Project.swift:
.target(
    name: "YourApp",
    dependencies: [
        .external(name: "RBSOdometer")
    ]
)

Manual Installation

  1. Clone the repository
  2. Add RBSOdometer/Classes/*.{h,m} files to your project
  3. Add the dependency: RBSReuseQueue

Usage

#import "RBSOdometerView.h"

// Create an odometer view
RBSOdometerView *odometerView = [[RBSOdometerView alloc] initWithFrame:CGRectMake(0, 0, 200, 50)];

// Configure appearance
odometerView.textColor = [UIColor blackColor];
odometerView.font = [UIFont systemFontOfSize:32];

// Set animation properties
odometerView.duration = 1.0; // Animation duration in seconds
odometerView.density = 5;     // Number density for animation

// Animate to a new value
[odometerView setNumber:@"12345"];

// Add to your view hierarchy
[self.view addSubview:odometerView];

Running the Example

To run the example project:

git clone https://github.com/RbBtSn0w/RBSOdometer.git
cd RBSOdometer
tuist install
tuist generate
open RBSOdometer.xcworkspace

Then build and run the RBSOdometerExample scheme.

Documentation

For detailed API documentation, see the header files:

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Author

RbBtSn0w

License

RBSOdometer is available under the MIT license. See the LICENSE file for more details.

Acknowledgements

  • Built with Tuist for modern Xcode project management
  • Uses RBSReuseQueue for efficient view reuse

About

iOS Number Odometer Animation

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 5