Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5973133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:45:25+00:00 2026-05-22T20:45:25+00:00

Is there an equivalent to Sinatra’s style URL routing for use with objective-C? I

  • 0

Is there an equivalent to Sinatra’s style URL routing for use with objective-C? I wish to map strings to functions with arguments to handle some internal navigation logic.

I would like to have a controller manage routes like what happens in Davis.js, Express, Sinatra etc. I know TTNavigationController has this mapping, but I am looking for something more lightweight and not tied to a UIKit (or similar) NavigationController.

Something which would would work like the following:

 // in a controller
 [Router map:@"/page/:name/" toSelector:@selector(loadPage:)];

 // then elsewhere
 [Router dispatch:@"/page/about/"];

I understand this is possible to create this myself, but before going down this route (excuse the pun) I would like to know if there is anything out there already. I created my own JavaScript implementation previously, then weeks later a number of superior libraries were created/publicised.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:45:26+00:00Added an answer on May 22, 2026 at 8:45 pm

    I have created an implementation of this on GutHub: https://github.com/rc1/RCRouter.

    It is not yet battle tested but a proof of concept and is very likely needs some improvements. Any help to improve it will be much appreciated.

    Here is the Example Usage usage:

    #include "RCRouter.h"
    
    -(id)init {
    
        // map routes
        [RCRouter map:@"/page/:title/" to:self with:@selector(page:)];
        [RCRouter map:@"/color/:r/:g/:b/:a/" to:self with:@selector(color:)];
    
        // dispatch routes
        [RCRouter dispatch:@"/page/welcome/"];
        [RCRouter dispatch:@"/color/255/255/255/255/"];
    
    }
    
    - (void)page:(NSDictionary*)params {
    
        NSString *pageTitle = [params objectForKey:@"title"];
    
    }
    
    - (void)color:(NSDictionary*)params {
    
        float red = [[params objectForKey:@"r"] floatValue];
        float green = [[params objectForKey:@"g"] floatValue];
        float blue = [[params objectForKey:@"b"] floatValue];
    
    }
    

    Delegate

    Add delegate to the Router can also be added by using the following:

    [RCRouter addDelegate:self];
    

    The following optional delegate methods are available as part of :

    - (BOOL)allow:(NSString*)route;
    - (void)willDispatchRoute:(NSString*)route to:(id)object;
    - (void)didDispatchRoute:(NSString*)route to:(id)object;
    - (void)noRouteFor:(NSString*)route;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an equivalent of the <c:url/> tag (of jsp core taglib fame) for
Are there any equivalent JavaScript functions for Python's urllib.parse.quote() and urllib.parse.unquote() ? The closest
Is there an equivalent of right() function that I can use in jquery. I
Are there equivalent methods for ceilf and floorf for the NSDecimalNumber type? I couldn't
Is there an equivalent in Rails to PHP's die() ? I have a case
Is there any equivalent to Collections.getOnlyElement() that works with arrays? I'm aware it's a
In Microsoft Ribbon Control, there is RibbonRadioButton where we can use on the Ribbon
Is there an equivalent library for JAXB in .NET? I am trying to convert
Is there an equivalent to the unix less command that can be used within
Is there an equivalent in JavaScript for PHP's reference passing of variables? [PHP]: function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.