Objective-C-NuREPL-for-iOS
所属分类:编译器/解释器
开发工具:Objective-C
文件大小:0KB
下载次数:0
上传日期:2012-10-15 04:38:58
上 传 者:
sh-1993
说明: 通过使用Nu-Lisp指令的clojure repl,直接向模拟器中正在运行的iOS应用程序发出指令。你可以玩wh...,
(Give instructions directly to a running iOS app in the simulator, through a clojure repl using Nu Lisp instructions. You can play with whatever objects that are accessible. Wanted something like RubyMotion REPL. So hacked this up!)
文件列表:
.DS_Store (6148, 2012-10-14)
Remote/ (0, 2012-10-14)
Remote/.DS_Store (6148, 2012-10-14)
Remote/Nu.h (51287, 2012-10-14)
Remote/NuRemote/ (0, 2012-10-14)
Remote/NuRemote/AsyncSocket.h (22511, 2012-10-14)
Remote/NuRemote/AsyncSocket.m (95951, 2012-10-14)
Remote/NuRemote/NRStats.h (1058, 2012-10-14)
Remote/NuRemote/NRStats.m (2626, 2012-10-14)
Remote/NuRemote/RemotingClient.h (1448, 2012-10-14)
Remote/NuRemote/RemotingClient.m (8212, 2012-10-14)
Remote/NuRemote/SPNuRemote.h (2512, 2012-10-14)
Remote/NuRemote/SPNuRemote.m (9790, 2012-10-14)
Remote/NuRemote/Shared.h (1197, 2012-10-14)
Remote/libNuTouchLibrary.a (970400, 2012-10-14)
Remote/libffi.a (177968, 2012-10-14)
Remote/libffi/ (0, 2012-10-14)
Remote/libffi/LICENSE (1119, 2012-10-14)
Remote/libffi/ffi.S (16343, 2012-10-14)
Remote/libffi/ffi.c (34547, 2012-10-14)
Remote/libffi/ffi.h (29426, 2012-10-14)
Remote/objc/ (0, 2012-10-14)
Remote/objc/Nu.h (50240, 2012-10-14)
Remote/objc/Nu.m (358203, 2012-10-14)
objc-repl/ (0, 2012-10-14)
objc-repl/doc/ (0, 2012-10-14)
objc-repl/doc/intro.md (127, 2012-10-14)
objc-repl/project.clj (269, 2012-10-14)
objc-repl/src/ (0, 2012-10-14)
objc-repl/src/objc_repl/ (0, 2012-10-14)
objc-repl/src/objc_repl/core.clj (976, 2012-10-14)
objc-repl/test/ (0, 2012-10-14)
objc-repl/test/objc_repl/ (0, 2012-10-14)
objc-repl/test/objc_repl/core_test.clj (133, 2012-10-14)
# 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
Thanks to Tim Burks for Nu Lisp!
# Usage
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;
Declare in the app delegate interface an SPNuRemote object
SPNuRemote *remote;
In the app delegate .m file
#import "NuRemote/SPNuRemote.h"
and somewhere in the function
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
write
remote = [SPNuRemote new];
[remote run];
Thats it!
# Running
First run the simulator app.
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")
Use the following method
objc-repl.core> (sim "(log \"Hello ObjC from Clojure\")")
General syntax is
(sim "Nu Code")
Nu code is Objective-C code but with square brackets replaced with round ones.
NSStrings are just "string" instead of @"string"
Selectors are defined as "showScreen" instead of @selector(showScreen)
and, structs like CGRect for frames are lists
# Example:
Suppose 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))")
Like changing a button frame
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)")
Enjoy!
近期下载者:
相关文件:
收藏者: