NSURLSession is the main networking API provided by Foundation that allows issuing HTTP requests and handling responses. Popular third party libraries like Alamofire and Moya provide abstractions over NSURLSession to simplify networking code. JSON parsing in Swift requires using third party libraries like Gloss to implement type checking and avoid callback hell when handling JSON responses.
Core Data with multiple managed object contextsMatthew Morey
When using Core Data for persisting app data multiple managed object contexts (MOC) are often required to avoid blocking UI. Typically you would create a background MOC and listen for changes on the main MOC, merging changes as necessary. With iOS 5, MOCs now have parent context and the ability to set concurrency types. These new features greatly simplify dealing with Core Data on background queues. During this presentation Matt will cover the pros and cons of this new method of dealing with Core Data.
mobile in the cloud with diamonds. improved.Oleg Shanyuk
Software development evolution is here. We gotta open source. We making better blocks.
In this presentation I show you some iOS related techniques for automatic data synchronisation. And overall - tools for rapid development and testing your software.
You may all know that JSON is a subset of JavaScript, but… Did you know that HTML5 implements NoSQL databases? Did you know that JavaScript was recommended for REST by HTTP co-creator Roy T. Fielding himself? Did you know that map & reduce are part of the native JavaScript API? Did you know that most NoSQL solutions integrate a JavaScript engine? CouchDB, MongoDB, WakandaDB, ArangoDB, OrientDB, Riak…. And when they don’t, they have a shell client which does. The story of NoSQL and JavaScript goes beyond your expectations and opens more opportunities than you might imagine… What better match could you find than a flexible and dynamic language for schemaless databases? Isn’t an event-driven language what you’ve been waiting for to manage consistency? When NoSQL doesn’t come to JavaScript, JavaScript comes to NoSQL. And does it very well.
Core Data with multiple managed object contextsMatthew Morey
When using Core Data for persisting app data multiple managed object contexts (MOC) are often required to avoid blocking UI. Typically you would create a background MOC and listen for changes on the main MOC, merging changes as necessary. With iOS 5, MOCs now have parent context and the ability to set concurrency types. These new features greatly simplify dealing with Core Data on background queues. During this presentation Matt will cover the pros and cons of this new method of dealing with Core Data.
mobile in the cloud with diamonds. improved.Oleg Shanyuk
Software development evolution is here. We gotta open source. We making better blocks.
In this presentation I show you some iOS related techniques for automatic data synchronisation. And overall - tools for rapid development and testing your software.
You may all know that JSON is a subset of JavaScript, but… Did you know that HTML5 implements NoSQL databases? Did you know that JavaScript was recommended for REST by HTTP co-creator Roy T. Fielding himself? Did you know that map & reduce are part of the native JavaScript API? Did you know that most NoSQL solutions integrate a JavaScript engine? CouchDB, MongoDB, WakandaDB, ArangoDB, OrientDB, Riak…. And when they don’t, they have a shell client which does. The story of NoSQL and JavaScript goes beyond your expectations and opens more opportunities than you might imagine… What better match could you find than a flexible and dynamic language for schemaless databases? Isn’t an event-driven language what you’ve been waiting for to manage consistency? When NoSQL doesn’t come to JavaScript, JavaScript comes to NoSQL. And does it very well.
Spring Data is a high level SpringSource project whose purpose is to unify and ease the access to different kinds of persistence stores, both relational database systems and NoSQL data stores.
FITC presents: Mobile & offline data synchronization in Angular JSFITC
Save 10% off ANY FITC event with discount code 'slideshare'
See our upcoming events at www.fitc.ca
OVERVIEW
Are you building mobile or web applications with AngularJS and wish they would work when you were offline? You can read, send and delete mail from your mobile email client when you are offline, why not from your AngularJS app? AngularJS is completely agnostic when it comes to creating your data models. Let’s explore what is required to allow your application to be useful to your users even without an internet connection.
INTENDED AUDIENCE - BEGINNER - INTERMEDIATE
This presentation is for developers that know they are looking for offline and data synchronization capabilities. Or, possibly for managers that wish to have a greater understanding of what their options are in AngularJS to create such functionality.
Daniel Zen, CEO, Zen Digital
Daniel Zen is the CEO of Zen Digital, founder of the New York AngularJS Meetup, a frequent lecturer, and a former consultant for Google, Pivotal Labs and various Fortune 500 companies. Zen Digital uses Agile techniques to move projects forward while continuously integrating new code and ideas, producing elegant frontend experiences and efficient backend systems for web and mobile applications.
http://highperformancecoredata.com/
Learn how to analyze, debug, and squeeze every last bit of performance out of Core Data. The standard Core Data implementation is very powerful and flexible but lacks performance. In this advanced session we will cover various performance analysis tools, model optimization, and various high performance concurrency models. This is an advanced discussion that assumes you have used Core Data before.
Paris Tech Meetup talk : Troubles start at version 1.0Laurent Cerveau
Presentation given at the Paris Tech Meetup 2013. A checklist (with code example for iOS development) to anticipate potential problems that can happen during the upgrade process of an application.
We describe the features of Oak Lucene indexes and how they can be used to get your queries perform better. In the second part we will talk about how asynchronous indexing works in general and how it can be monitored.
This was presented as part of AEM Gem Series -http://dev.day.com/content/ddc/en/gems/oak-lucene-indexes.html
This is a comprehensive slide on implementing web service in iOS . There are basic information on Web Service . There are steps of using web service in iOS. The presentation emphasized on XML Parsing .
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...DicodingEvent
Dicoding Developer Coaching merupakan webinar, yang membahas tuntas kendala maupun pertanyaan yang sering ditanyakan di Academy Dicoding.
Tema kali ini adalah "Menyimpan Database Secara Local di Aplikasi Androidmu."
Di sini Anda akan mempelajari tentang pengembangan aplikasi pada berbagai platform yang tidak luput dari proses penyimpanan dan manipulasi data. Pada perangkat Android, terdapat beragam mekanisme penyimpanan yang bergantung pada kebutuhan aplikasi. Pada umumnya penyimpanan dan pengolahan data di Android terbagi menjadi beberapa komponen seperti penyimpan di onSavedInstanceState, penggunaan SharedPreferences, SQLite Database, Content Provider, dan lain sebagainya.
Spring Data is a high level SpringSource project whose purpose is to unify and ease the access to different kinds of persistence stores, both relational database systems and NoSQL data stores.
FITC presents: Mobile & offline data synchronization in Angular JSFITC
Save 10% off ANY FITC event with discount code 'slideshare'
See our upcoming events at www.fitc.ca
OVERVIEW
Are you building mobile or web applications with AngularJS and wish they would work when you were offline? You can read, send and delete mail from your mobile email client when you are offline, why not from your AngularJS app? AngularJS is completely agnostic when it comes to creating your data models. Let’s explore what is required to allow your application to be useful to your users even without an internet connection.
INTENDED AUDIENCE - BEGINNER - INTERMEDIATE
This presentation is for developers that know they are looking for offline and data synchronization capabilities. Or, possibly for managers that wish to have a greater understanding of what their options are in AngularJS to create such functionality.
Daniel Zen, CEO, Zen Digital
Daniel Zen is the CEO of Zen Digital, founder of the New York AngularJS Meetup, a frequent lecturer, and a former consultant for Google, Pivotal Labs and various Fortune 500 companies. Zen Digital uses Agile techniques to move projects forward while continuously integrating new code and ideas, producing elegant frontend experiences and efficient backend systems for web and mobile applications.
http://highperformancecoredata.com/
Learn how to analyze, debug, and squeeze every last bit of performance out of Core Data. The standard Core Data implementation is very powerful and flexible but lacks performance. In this advanced session we will cover various performance analysis tools, model optimization, and various high performance concurrency models. This is an advanced discussion that assumes you have used Core Data before.
Paris Tech Meetup talk : Troubles start at version 1.0Laurent Cerveau
Presentation given at the Paris Tech Meetup 2013. A checklist (with code example for iOS development) to anticipate potential problems that can happen during the upgrade process of an application.
We describe the features of Oak Lucene indexes and how they can be used to get your queries perform better. In the second part we will talk about how asynchronous indexing works in general and how it can be monitored.
This was presented as part of AEM Gem Series -http://dev.day.com/content/ddc/en/gems/oak-lucene-indexes.html
This is a comprehensive slide on implementing web service in iOS . There are basic information on Web Service . There are steps of using web service in iOS. The presentation emphasized on XML Parsing .
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...DicodingEvent
Dicoding Developer Coaching merupakan webinar, yang membahas tuntas kendala maupun pertanyaan yang sering ditanyakan di Academy Dicoding.
Tema kali ini adalah "Menyimpan Database Secara Local di Aplikasi Androidmu."
Di sini Anda akan mempelajari tentang pengembangan aplikasi pada berbagai platform yang tidak luput dari proses penyimpanan dan manipulasi data. Pada perangkat Android, terdapat beragam mekanisme penyimpanan yang bergantung pada kebutuhan aplikasi. Pada umumnya penyimpanan dan pengolahan data di Android terbagi menjadi beberapa komponen seperti penyimpan di onSavedInstanceState, penggunaan SharedPreferences, SQLite Database, Content Provider, dan lain sebagainya.
Building quality software, with low defect counts, conformance to specifications and a clean code base is an important goal for any growing software company. Really high quality can only be maintained by introducing process & automation into the development process. This talk gives an overview of different tools that can help increase software quality, using a Ruby on Rails app as the example environment.
Taming Core Data by Arek Holko, MacoscopeMacoscope
Core Data is a framework that you use to manage the model layer objects in your application. A framework that you use to build the persistence layer in your application.
Using Kotlin coroutines it’s really easy to execute a task in a background thread and update the UI based on the result. Just enter the coroutine world using the launch method and then change thread using withContext. It’s even simpler if the task is an http call (thanks to coroutines support in retrofit) or a database query (thanks to Room). The final code is the same we’d use to execute synchronous code. But coroutines are more than just a tool to switch thread, we can use them to execute tasks in parallel. The code is still really easy to read but sometimes it can be difficult to write: we need to pay attention to many aspects (like nested scopes, exceptions and dispatchers). In this talk we’ll see how to leverage the coroutines library to manage parallelism, from the basic concepts to some advanced example.
In the Apple ecosystem, everyone has their own way of implementing a network stack. Many end up with a large `WebService` class where everything gets dumped. These classes, like massive view controllers, expose broad interfaces that are hard to understand, unwieldy to use, and difficult to test.
But network stacks don't have to be like this! Let's talk about how you can use the Swish framework to build a protocol-oriented and testable networking stack in Swift that will make you happy.
Presented at the Swift Language User Group in SF at Realm.
http://www.meetup.com/swift-language/events/232911843/
You're on another typical JavaEE-based project, and you find yourself writing the same old infrastructure code. Are you wondering if there's a quicker way to incorporate the basics such as configuration, logging, and email into your application? If so, then this presentation is for you. By using a number of Apache utilities from
Commons, Logging, and other areas, you can learn how to stop re-inventing the wheel.
We'll start with a simple Struts 2 application and iteratively add the ability to:
• Use Commons Lang for String and Date utilities.
• Use Commons Property Configuration to setup and use application Properties.
• Use Commons Logging and Log4J to log messages.
• Generate Excel spreadsheets with POI.
• Use Velocity Templates and Commons Email to format and send email messages.
• Use HttpClient to invoke web apps with HTTP/S.
• Use Commons IOUtils to simplify accessing web content.
This presentation deals with every possible topics under JSON (JavaScript Object Notation) which every web developers should know.
It is presented by Rajasekhar who works at United Online as a Web Developer
With the advent of asyncio, the python community started to build new performant web frameworks and servers for asynchronous backends. In this way, ASGI specification appeared as a successor to WSGI.
In this talk, we will take a closer look into the details of this new specification and consider its implementation in the uvicorn server and Starlette framework.
Talk was presented at PGConfUS on April 20th, 2016.
___________
With features like foreign data wrappers, Postgres makes it easy for you to integrate rich data stores into your application architectures. Yet sometimes you only have a few rich data structures to deal with, or can’t afford the time and resource cost of running a NoSQL cluster alongside Postgres. Happily Postgres natively supports several document data formats, giving you the best of both worlds in one database. You can keep document oriented data solely within Postgres, or write a foreign table schema that’s naturally compatible with your document database.
At this talk you’ll learn how to access document data stored in Postgres, and write Ruby code to make use of the data with your favorite ORM. We’ll survey the various document stores which are natively supported in Postgres. You’ll learn what are the pros and cons of each data type, and come away understanding which use cases are best suited to each document store.
This presentation gives a high level concepts and more of code to take a stab at developing a simple Restful server. I targeted people who would like to build a simple RESTFul server from scratch and experiment.
Free Downloadable PDF guide Volume #2 Learn to code JavaScript #javascript
A closure in JavaScript is a function that has access to variables in its parent scope, even after the parent function has returned. Closures are created when a function is defined inside another function, and the inner function retains access to the variables in the outer function’s scope.
Here is an example of a closure in JavaScript:In this example, the innerFunction is a closure because it has access to the variable x and innerVar from the outerFunction even after outerFunction has returned.
A closure has three scope chains:
It has access to its own scope (variables defined between its curly braces {}).
It has access to the outer function’s variables.
It has access to the global variables.
Closures are commonly used in JavaScript for a variety of tasks, such as:
Implementing private methods and variables.
Creating callback functions that retain access to variables from their parent scope.
Creating and returning an object that has access to variables from its parent scope.
JavaScript closures are an important concept and it is important to understand how closures work in JavaScript. It is also important to be aware of the scope chain, and how closures interact with the scope chain.JavaScript Object Notation (JSON) is a lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition – December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.
[@IndeedEng] Building Indeed Resume Searchindeedeng
Video available: http://youtu.be/qcnP5gQGBaU
Software engineer David Tulig will dive into the architecture of Indeed’s Resume Instant Search and our use of the Google Closure tools. David will explain how we write maintainable, efficient JavaScript components for Resume Instant Search and other Indeed products. He will discuss how we create templates that run on both client and server, providing fast initial page load time and search engine-friendly pages with the responsiveness of client-side rendering.
Speaker:
David Tulig is a software engineer on the Job Search team at Indeed. David has worked on employer, resume, and job search products during his 4 years at Indeed.
Similar to Client Server Communication on iOS (20)
Strategies for Successful Data Migration Tools.pptxvarshanayak241
Data migration is a complex but essential task for organizations aiming to modernize their IT infrastructure and leverage new technologies. By understanding common challenges and implementing these strategies, businesses can achieve a successful migration with minimal disruption. Data Migration Tool like Ask On Data play a pivotal role in this journey, offering features that streamline the process, ensure data integrity, and maintain security. With the right approach and tools, organizations can turn the challenge of data migration into an opportunity for growth and innovation.
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
Tim Combridge from Sensible Giraffe and Salesforce Ben presents some important tips that all developers should know when dealing with Flows in Salesforce.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
Your Digital Assistant.
Making complex approach simple. Straightforward process saves time. No more waiting to connect with people that matter to you. Safety first is not a cliché - Securely protect information in cloud storage to prevent any third party from accessing data.
Would you rather make your visitors feel burdened by making them wait? Or choose VizMan for a stress-free experience? VizMan is an automated visitor management system that works for any industries not limited to factories, societies, government institutes, and warehouses. A new age contactless way of logging information of visitors, employees, packages, and vehicles. VizMan is a digital logbook so it deters unnecessary use of paper or space since there is no requirement of bundles of registers that is left to collect dust in a corner of a room. Visitor’s essential details, helps in scheduling meetings for visitors and employees, and assists in supervising the attendance of the employees. With VizMan, visitors don’t need to wait for hours in long queues. VizMan handles visitors with the value they deserve because we know time is important to you.
Feasible Features
One Subscription, Four Modules – Admin, Employee, Receptionist, and Gatekeeper ensures confidentiality and prevents data from being manipulated
User Friendly – can be easily used on Android, iOS, and Web Interface
Multiple Accessibility – Log in through any device from any place at any time
One app for all industries – a Visitor Management System that works for any organisation.
Stress-free Sign-up
Visitor is registered and checked-in by the Receptionist
Host gets a notification, where they opt to Approve the meeting
Host notifies the Receptionist of the end of the meeting
Visitor is checked-out by the Receptionist
Host enters notes and remarks of the meeting
Customizable Components
Scheduling Meetings – Host can invite visitors for meetings and also approve, reject and reschedule meetings
Single/Bulk invites – Invitations can be sent individually to a visitor or collectively to many visitors
VIP Visitors – Additional security of data for VIP visitors to avoid misuse of information
Courier Management – Keeps a check on deliveries like commodities being delivered in and out of establishments
Alerts & Notifications – Get notified on SMS, email, and application
Parking Management – Manage availability of parking space
Individual log-in – Every user has their own log-in id
Visitor/Meeting Analytics – Evaluate notes and remarks of the meeting stored in the system
Visitor Management System is a secure and user friendly database manager that records, filters, tracks the visitors to your organization.
"Secure Your Premises with VizMan (VMS) – Get It Now"
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Hivelance Technology
Cryptocurrency trading bots are computer programs designed to automate buying, selling, and managing cryptocurrency transactions. These bots utilize advanced algorithms and machine learning techniques to analyze market data, identify trading opportunities, and execute trades on behalf of their users. By automating the decision-making process, crypto trading bots can react to market changes faster than human traders
Hivelance, a leading provider of cryptocurrency trading bot development services, stands out as the premier choice for crypto traders and developers. Hivelance boasts a team of seasoned cryptocurrency experts and software engineers who deeply understand the crypto market and the latest trends in automated trading, Hivelance leverages the latest technologies and tools in the industry, including advanced AI and machine learning algorithms, to create highly efficient and adaptable crypto trading bots
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Into the Box Keynote Day 2: Unveiling amazing updates and announcements for modern CFML developers! Get ready for exciting releases and updates on Ortus tools and products. Stay tuned for cutting-edge innovations designed to boost your productivity.
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
Modern design is crucial in today's digital environment, and this is especially true for SharePoint intranets. The design of these digital hubs is critical to user engagement and productivity enhancement. They are the cornerstone of internal collaboration and interaction within enterprises.
6. CANONICAL EXAMPLE
let imageView = UIImageView()
let url = NSURL(string: "http://www.sbs.com.au/news/sites/sbs.com.au.news/files/styles/
full/public/g1369638954952825892.jpg.png?itok=eI4dUGhC&mtime=1429064409")!
let urlRequest = NSURLRequest(URL: url)
let session = NSURLSession.sharedSession()
let task = session.dataTaskWithRequest(urlRequest) { data, response, error in
if let data = data {
let image = UIImage(data: data)
dispatch_async(dispatch_get_main_queue()) {
imageView.image = image
}
}
}
task.resume()
7. CANONICAL EXAMPLE
1. Retrieve a session from NSURLSession
2. Create a task using that session
3. Provide a delegate or callback to deal with the response
8. NSURLSESSION - TASK TYPES
NSURLSessionDataTask: A task for retrieving the contents
of a URL as an NSData object
NSURLSessionUploadTask: A task for uploading a file,
then retrieving the contents of a URL as an NSData object
NSURLSessionDownloadTask: A task for retrieving the
contents of a URL as a temporary file on disk
Background compatible
Not background compatible!
Source: NSURLSession reference
9. POST EXAMPLE
let content = ["post": "test content"]
let jsonData = try! NSJSONSerialization.dataWithJSONObject(content, options:
NSJSONWritingOptions(rawValue: 0))
let urlPost = NSURL(string: "http://jsonplaceholder.typicode.com/posts")!
let urlRequestPost = NSMutableURLRequest(URL: urlPost)
urlRequestPost.HTTPMethod = "POST"
urlRequestPost.HTTPBody = jsonData
let postTask = session.dataTaskWithRequest(urlRequestPost) { data, response, error in
if let data = data {
print(response)
}
}
postTask.resume()
12. HANDLING JSON
let jsonOptional: AnyObject! = NSJSONSerialization.JSONObjectWithData(data,
options: NSJSONReadingOptions(0), error: &jsonErrorOptional)
if let json = jsonOptional as? Dictionary<String, AnyObject> {
if let id = json["id"] as? Int {
if let name = json["name"] as AnyObject? as? String {
if let email = json["email"] as AnyObject? as? String {
let user = User(id: id, name: name, email: email)
callback(user)
}
}
}
}
😢 😢 😢 😢 😢 😢 😢 😢 😢 😢 😢 😢 😢
Source: Efficient JSON in Swift with Functional Concepts and Generics
13. HANDLING JSON
For sane JSON parsing code we need to use third party
libraries that implement type checking for us
There are many libraries available: SwiftyJSON, Argo, Gloss,
etc.
17. THIRD PARTY NETWORKING
Networking code encounters issues that are similar for all
different kinds of apps
Third party libraries help in solving these common problems
(e.g. parsing responses from as server)
18. THIRD PARTY NETWORKING
Alamofire: an abstraction on top of NSURLSession with a
simplified API
Moya: built on top of Alamofire, improves modeling of API
client
Tiny networking: a minimal networking library by Chris
Eidhof, read accompanying blog post
20. SUMMARY
NSURLSession is the main networking API
(Sane) JSON parsing in Swift 2 requires third party
libraries
Popular third party networking libraries provide
abstractions over NSURLSession
22. ADDITIONAL RESOURCES
NSURLSession Playground for this talk
NSURLSession class reference
NSURLSession Background Download
URLSession programming guide
Swift JSON Parsing by Example