C# on the iPhone with MonoTouch Glasgow
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

C# on the iPhone with MonoTouch Glasgow

on

  • 1,841 views

My slides from C# on the iPhone at DDD Scotland on 8th May 2010.

My slides from C# on the iPhone at DDD Scotland on 8th May 2010.

Statistics

Views

Total Views
1,841
Views on SlideShare
1,662
Embed Views
179

Actions

Likes
1
Downloads
23
Comments
0

2 Embeds 179

http://weblogs.asp.net 174
http://www.slideshare.net 5

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Good afternoon, I&#x2019;m going to talk a little bit about C# on the iPhone with Monotouch. I&#x2019;m Chris Hardy and you go follow me on twitter @ chrisntr. <br />
  • Good afternoon, I&#x2019;m going to talk a little bit about C# on the iPhone with Monotouch. I&#x2019;m Chris Hardy and you go follow me on twitter @ chrisntr. <br />
  • I work for a company called Great Fridays and we&#x2019;re mainly a web design agency working for people such as Ubisoft, Peter Gabriel and Emma Watson <br /> <br />
  • I work for a company called Great Fridays and we&#x2019;re mainly a web design agency working for people such as Ubisoft, Peter Gabriel and Emma Watson <br /> <br />
  • I work for a company called Great Fridays and we&#x2019;re mainly a web design agency working for people such as Ubisoft, Peter Gabriel and Emma Watson <br /> <br />
  • I work for a company called Great Fridays and we&#x2019;re mainly a web design agency working for people such as Ubisoft, Peter Gabriel and Emma Watson <br /> <br />
  • <br />
  • <br />
  • This session I will be covering and hopefully answering some of your question on... <br /> What is Monotouch... <br /> How does it work... <br /> Why would you use it... <br /> and I&#x2019;ll also show a demo or two on using MonoTouch <br />
  • This session I will be covering and hopefully answering some of your question on... <br /> What is Monotouch... <br /> How does it work... <br /> Why would you use it... <br /> and I&#x2019;ll also show a demo or two on using MonoTouch <br />
  • This session I will be covering and hopefully answering some of your question on... <br /> What is Monotouch... <br /> How does it work... <br /> Why would you use it... <br /> and I&#x2019;ll also show a demo or two on using MonoTouch <br />
  • This session I will be covering and hopefully answering some of your question on... <br /> What is Monotouch... <br /> How does it work... <br /> Why would you use it... <br /> and I&#x2019;ll also show a demo or two on using MonoTouch <br />
  • This session I will be covering and hopefully answering some of your question on... <br /> What is Monotouch... <br /> How does it work... <br /> Why would you use it... <br /> and I&#x2019;ll also show a demo or two on using MonoTouch <br />
  • In the summer I thought I&#x2019;d have a go at iPhone programming, it&#x2019;s fun and it&#x2019;s enjoyable and it also involves... <br />
  • using Objective C and Xcode... this lead me to learn objective-c... which was hard coming from a PHP/Web background. Constant errors and manually hacking at SOAP requests was not much fun... XCode on the other hand was really nice although there is no concept of a project folder... <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • So, what is MonoTouch? First of all we should ask a different question. <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • The CIL (Common Intermediate Language) / Assembley is sent to Mono at Runtime and executed directly in memory... <br />
  • The CIL (Common Intermediate Language) / Assembley is sent to Mono at Runtime and executed directly in memory... <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

C# on the iPhone with MonoTouch Glasgow Presentation Transcript

  • 1. C# on the iPhone with MonoTouch Chris Hardy follow on Twitter - @chrisntr
  • 2. http://greatfridays.com
  • 3. iPhone apps built with MonoTouch
  • 4. iPad apps built with MonoTouch
  • 5. Covering...
  • 6. Covering... • How MonoTouch works...
  • 7. Covering... • How MonoTouch works... • Why would you use it?
  • 8. Covering... • How MonoTouch works... • Why would you use it? • Section 3.3.1 ...
  • 9. Covering... • How MonoTouch works... • Why would you use it? • Section 3.3.1 ... • Demos
  • 10. Starting point....
  • 11. Objective C and Xcode
  • 12. Learn to read Objective-C
  • 13. Learn to read Objective-C
  • 14. Learn to read Objective-C
  • 15. Learn to read Objective-C • All Apple documentation is in Obj-C
  • 16. Learn to read Objective-C • All Apple documentation is in Obj-C • Most examples are in Obj-C
  • 17. Learn to read Objective-C • All Apple documentation is in Obj-C • Most examples are in Obj-C • It’s not too hard to understand
  • 18. Learn to read Objective-C • All Apple documentation is in Obj-C • Most examples are in Obj-C • It’s not too hard to understand • It might even be fun...
  • 19. What is MonoTouch?
  • 20. What is Mono?
  • 21. What is Mono?
  • 22. What is Mono?
  • 23. What is Mono? The .Net Framework
  • 24. What is Mono? The .Net Framework
  • 25. Mono’s JIT Engine Memory Mono CIL
  • 26. Apple No No... • Contractual Requirements • No interpreted code • No shared libraries • Kernel Limitations • iPhone OS 2.0+ disables JIT
  • 27. Mono’s AOT Engine Native Code Mono AOT Mono Runtime CIL ARM
  • 28. Monotouch Features • mtouch • MonoDevelop iPhone Add-In • CocoaTouch.NET • Full static AOT compiler • Support for all your existing code • Reflection • Generics • LINQ • Anonymous Methods • Lambda’s etc...
  • 29. MonoTouch’s APIs
  • 30. The Bindings • MonoTouch namespace • MonoTouch.Foo namespace • Maps to CocoaTouch’s Foo Framework • 1:1 Mapping of classes. • MonoTouch.UIKit.UILabel • CocoaTouch’s UIKit framework, UILabel class
  • 31. Strong Types • Objective-C • Arrays are weakly typed: • NSArray return values. • MonoTouch has strong types • UIView[] Subviews { get; } • vs • NSArray *subviews; • Intellisense - explore the API...
  • 32. Garbage Collection • Automatic: • Mono’s GC will collect objects on demand • Deterministic: • Use when you need control. • Every object in MonoTouch implements IDisposable using (var image = UIImage.FromFile(“foo.png”)){ surface.DrawImage(image, 20, 20); }
  • 33. Linker
  • 34. What about App Size? • 20 MB (compressed) limit on 3G/Edge downloads • .Net BCL and other libraries are huge • Mono Linker to the rescue!
  • 35. Linking Assemblies
  • 36. Linker Options • No Link • Link SDK Only • Full Link
  • 37. Pipeline • Interface Builder GUI Designer • Exact same tool used by Xcode • Support for existing Xcode interfaces • MonoDevelop IDE
  • 38. Integration • Tight integration between MD and IB • IB produces XIBs with MD parses • Automatic class generation in MD • Generates partial classes for all types, outlets and actions defined in Interface Builder
  • 39. Outlets • Instance Variables • Can be strong or loosely typed • MD will strong type
  • 40. Actions • Objects emit broadcast messages to receivers • You can do this C# • MonoDevelop takes care of the details for you • Creates partial methods for you extend
  • 41. MonoTouch Events • Supports Objective-C pattern: webView.Delegate = new MyWebViewDelegate(); • C# style events as well: webView.PageLoaded += delegate { HideSpinningWheel(); }
  • 42. Debugging • Console.WriteLine(“Debugging inside of MonoTouch”); • printf(“I made it to this line!n”)
  • 43. Well...
  • 44. Well...
  • 45. Well... • MonoTouch 1.0 on 15th September 2009
  • 46. Well... • MonoTouch 1.0 on 15th September 2009 • MonoTouch 1.1 on 2nd October 2009
  • 47. Well... • MonoTouch 1.0 on 15th September 2009 • MonoTouch 1.1 on 2nd October 2009 • MonoTouch 1.2 (Beta) released on 28th October 2009... With Debugging support
  • 48. Well... • MonoTouch 1.0 on 15th September 2009 • MonoTouch 1.1 on 2nd October 2009 • MonoTouch 1.2 (Beta) released on 28th October 2009... With Debugging support • Currently on MonoTouch 2.0.2
  • 49. Debugger • MonoTouch debugger leverages Mono’s new Soft-Debugger • Supports the Simulator • Supports the Device... • even over WiFi
  • 50. Debugger Features • Breakpoints • Catchpoints • Inspection • Watches • Immediate / Expression Evaluator • Call Stack • Stepping
  • 51. Caveats • Debug binaries on devices are very large • Cannot debug Main or FinishedLaunching on device • Consumes more memory runtime • Performance hit
  • 52. Getting started • Get iPhone SDK from Apple • Get Mono from Novell • Get MonoTouch (evaluation version is free) • Get MonoDevelop • Register with Apple iPhone Developer Program and purchase MonoTouch for putting apps on device and AppStore.
  • 53. iPad
  • 54. iPad • But you want to develop for the iPad...
  • 55. iPad • But you want to develop for the iPad... • 24 Hours after the SDK was released...
  • 56. iPad • But you want to develop for the iPad... • 24 Hours after the SDK was released... • MonoTouch support for iPad
  • 57. iPad • But you want to develop for the iPad... • 24 Hours after the SDK was released... • MonoTouch support for iPad • Fully supported with MonoTouch 2.0
  • 58. Apple’s new TOS • 3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).
  • 59. Professional iPhone Programming with MonoTouch and .NET/ C# Wallace B. McClure Rory Blyth Martin Bowling Craig Dunn and me... Chris Hardy Out in Summer
  • 60. Demo time...
  • 61. Q +A twitter.com/chrisntr chrisntr@gmail.com 10% off MonoTouch use DDDSCOT on MonoTouch.net