View
223
Download
0
Category
Preview:
Citation preview
REST in peace with Xamarin
@fekberg
Page
Contact filip.ekberg@readify.net http://fekberg.com +61 (401) 157-608 @fekberg C# Smorgasbord
/ Copyright ©2014 by Readify Pty Ltd 2
Page
What is Xamarin?
/ Copyright ©2014 by Readify Pty Ltd 3
› Enables you to reach all major mobile platforms › Gives you: › Native user interface › Native Performance › An awesome development experience
Page
Developing using Xamarin
/ Copyright ©2014 by Readify Pty Ltd 4
Xamarin Studio PC or Mac
Visual Studio Plugin
VS 2010/2012/2013
Page
Can we reuse code?
/ Copyright ©2014 by Readify Pty Ltd 5
› Yes! We can use PCL (Portable Class Libraries) › Different approaches: › Inject implementations › Inject Action/Func
› Create interface IFoo in PCL inject implementation iOS.Foo and Droid.Foo
Page
REST API?
/ Copyright ©2014 by Readify Pty Ltd 6
› Fancy way of saying API over HTTP › What REST API? iHackerNews! › http://api.ihackernews.com/
› HTTP GET -> /page returns a collection of entries public class Entry { public int Id { get; set; } public int Points { get; set; } public string PostedAgo { get; set; } public string PostedBy { get; set; } public string Title { get; set; } public string Url { get; set; } }
Page
How do you use REST from C#?
/ Copyright ©2014 by Readify Pty Ltd 7
Page
Performing a GET request
/ Copyright ©2014 by Readify Pty Ltd 8
var client = new HttpClient(); var result =
await client.GetStringAsync(HackerNewsApiUrls.Top);
Page
DEMO! Xamarin + C# + REST
/ Copyright ©2014 by Readify Pty Ltd 9
Page
Summary
/ Copyright ©2014 by Readify Pty Ltd 10
› Easy to have business logic in a shared library (PCL) › Consuming REST APIs are easy! › Xamarin makes it all enjoyable
Page
Questions?
/ Copyright ©2014 by Readify Pty Ltd 11
Page
Thank you! filip.ekberg@readify.net http://fekberg.com +61 (401) 157-608 @fekberg C# Smorgasbord
/ Copyright ©2014 by Readify Pty Ltd 12
Recommended