Sunday, November 11, 2012

I'm willing to open-source my switch-scanning code

I got my switch scanning feature working. I went with making the button grow when it is selected.

While I was writing the code, I realized that there's nothing really special about this feature. Everyone who is supporting switch scanning has similar-looking code, and there's really no reason for us all to implement this feature separately. It would be better for all of us to pool our efforts and create a standard library that can drop into any app to support scanning easily.

If anyone else is interested, I'll go first. I'm willing to release the source code for my scanning code (and the associated test code, which is actually bigger) under a relaxed open-source license.

I believe github.com will host open-source code for free, so the only real work for me will be to sort out what license I need, write some (limited) documentation, and adjust the copyright lines in my source files.

I use several open-source libraries in the Switchamajig app, and they have made my life tremendously easier. It would be great to give something back, even something as simple as the scanner. I may also end up with a better app if others want to spend some of the time they save improving the scanner.

Please leave a comment if you'd like the code. If nobody's interested, there's no reason for me to spend the time sharing it. In case you're curious, here's what the interface looks like:

enum {SCANNING_STYLE_NONE=0,SCANNING_STYLE_AUTO_SCAN=1,SCANNING_STYLE_STEP_SCAN=2};

@protocol SJUIExternalSwitchScannerDelegate <NSObject>
@required
- (void) SJUIExternalSwitchScannerItemWasSelected:(id)item;
- (void) SJUIExternalSwitchScannerItemWasActivated:(id)item;
@end
 

@interface SJUIExternalSwitchScanner : NSObject <UITextFieldDelegate>
@property (nonatomic) id<SJUIExternalSwitchScannerDelegate> delegate;
@property NSNumber *autoScanInterval;
- (void) addButtonToScan:(UIButton*)button withLabel:(UILabel*)label;
- (id) initWithSuperview:(UIView*)superview andScanType:(int)scanTypeInit;
- (UIButton*) currentlySelectedButton;
- (void) superviewDidAppear;
@end



No comments:

Post a Comment