以前根據 CCL 的教程學會了如何在 Common Lisp 中調用 Cocoa 框架,編寫 MAC 應用程序。git
最近在考慮如何經過 Common Lisp 調用 Cocoa Touch 框架,開發 iOS 程序(iPhone/iPad),首先須要解決的問題就是如何在 Common Lisp 中啓動 iOS 模擬器,而且創建起通訊,進行交互(把寫好的 APP 上傳到模擬器中)。
github
雖然對於 iOS 高手來講沒什麼技術含量,不過確實是一個必須解決的問題(商業化的 Mocl 已經實現),準備慢慢搞定,這樣,之後就能夠直接使用 Common Lisp 來開發 iOS 應用了。shell
話說如今蘋果最新發布的 swift 也支持 REPL 了,說明 Lisp 這座金礦還有太多值得挖掘的寶藏,爲何不直接用 Lisp 來開發 app 呢?express
搜索了一下,找到下面這篇文檔,準備先學習參考一下swift
原文以下:app
The ECL for iOS distribution includes a code example of a Common Lisp application running on the iPhone.iphone The example is a Swank server, the backend for the SLIME and MCLIDE Lisp development environments (disclosure: I am the developer of the latter).ide Following the steps in the readme will build the application and place it on your iPhone/iPad, or alternatively on the iPhone simulator that comes with Xcode. You can then connect to the iOS device using SLIME or MCLIDE, providing a REPL from which you can evaluate Lisp expressions directly on the device and interactively develop the app.post The code example in the init.lisp file runs on the device as the application starts. It currently loads the swank server and notifies the user with a text field, button and alert dialog. The ECL for iPhone project doesn't yet provide much user interface functionality from Lisp, but you can use the Xcode Interface Builder to design the GUI. ECL compiles to C and supports inline Objective-C, so you can use Common Lisp as an abstraction layer on top or integrate Common Lisp implemented functionality with Objective-C code. The repository for the project includes examples of combining Common Lisp with Objective-C, including the implementation of basic widgets.
|
||||
add comment |