Merge: lib/counter: Added pack function
[nit.git] / lib / ios / ios.nit
index 9d5079d..4fd1d24 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# iOS services for Nit app on iOS
+# iOS platform support
 module ios
 
 import platform
 import app
+
+import cocoa::foundation
+
+redef fun print(msg) do msg.to_s.nslog
+redef fun print_error(msg) do msg.to_s.nslog
+
+redef class Text
+       private fun nslog do to_nsstring.nslog
+end
+
+redef class NSString
+       private fun nslog in "ObjC" `{ NSLog(@"%@", self); `}
+end
+
+redef class NativeString
+       # FIXME temp workaround for #1945, bypass Unicode checks
+       redef fun char_at(pos) do return self[pos].ascii
+end