Permalink
Browse files

Updated README

  • Loading branch information...
1 parent bbc9225 commit 276efb73995b51b2a64a1d0a191c624e1f18f507 @roupam committed Oct 13, 2012
Showing with 16 additions and 14 deletions.
  1. +16 −14 README.md
View
30 README.md
@@ -1,7 +1,6 @@
# Objective-C NuREPL for iOS
Give instructions directly to a running iOS app in the simulator, through a clojure repl. You can play with whatever objects that are synthesized ie., accessible.
-
The code syntax used for sending instructions is Nu Lisp.
http://programming.nu/reference
@@ -12,11 +11,14 @@ Thanks to Tim Burks for Nu Lisp!
Add the static libraries and .h .m files in the "Remote" folder into your XCode project.
In the app delegate .h file add the following above @interface:
-@class SPNuRemote;
+ @class SPNuRemote;
+
+In the app delegate .m file
+ #import "NuRemote/SPNuRemote.h"
-In the app delegate .m file #import "NuRemote/SPNuRemote.h" and somewhere in the function
+and somewhere in the function
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
write
@@ -31,11 +33,11 @@ Then do a lein swank in objc-repl and complile the core.clj
To execute a line of code in iOS simulator call the sim function.
For example to do NSLog("Hello ObjC from Clojure") do
-objc-repl.core> (sim "(log \"Hello ObjC from Clojure\")")
+ objc-repl.core> (sim "(log \"Hello ObjC from Clojure\")")
-General syntex is
+General syntax is
-(sim "Nu Code")
+ (sim "Nu Code")
Nu code is Objective-C code but with square brackets replaced with round ones.
NSStrings are just "string" instead of @"string"
@@ -46,20 +48,20 @@ and, structs like CGRect for frames are lists
Support there is a button synthesized inside a class rootViewController, and we want to change its backgroundcolor:
-objc-repl.core> (sim "(set root (((UIApplication sharedApplication) delegate) viewController))")
-objc-repl.core> (sim "((root button) setBackgroundColor:(UIColor greenColor))")
+ objc-repl.core> (sim "(set root (((UIApplication sharedApplication) delegate) viewController))")
+ objc-repl.core> (sim "((root button) setBackgroundColor:(UIColor greenColor))")
Like changing a button frame
-objc-repl.core> (sim "(button setFrame:'(10 10 20 20))")
+ objc-repl.core> (sim "(button setFrame:'(10 10 20 20))")
Creating a cutom button
For example UIButtonTypeCustom is 0 and UIControlStateNormal is also 0
-objc-repl.core> (sim "(set button (UIButton buttonWithType:'0))")
-objc-repl.core> (sim "(button setFrame:'(0 0 80 50))")
-objc-repl.core> (sim "(button setTitle:\"Click Me\" forState:'0)")
-objc-repl.core> (sim "((rootViewController view) addSubview:button)")
+ objc-repl.core> (sim "(set button (UIButton buttonWithType:'0))")
+ objc-repl.core> (sim "(button setFrame:'(0 0 80 50))")
+ objc-repl.core> (sim "(button setTitle:\"Click Me\" forState:'0)")
+ objc-repl.core> (sim "((rootViewController view) addSubview:button)")
Enjoy!

0 comments on commit 276efb7

Please sign in to comment.