Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

Lecture 8: Gestures JSON

June 8, 2020
by
Stanford
YouTube video player
Lecture 8: Gestures JSON

TL;DR

Learn how to use UserDefaults to store data persistently and how to handle gestures in SwiftUI.

Transcript

  • Stanford University. - Okay, welcome to lecture eight, Stanford CS193p, spring of 2020. I'm gonna try to keep the slides short today so we can jump into another big demo, but I need to talk about conceptual stuff behind a couple of things we're gonna do in the demo, namely UserDefaults, which is a very lightweight, persistent store that we're jus... Read More

Key Insights

  • 🏪 UserDefaults is a simple way to store small user preferences persistently, but it is not suitable for storing large amounts of data or documents.
  • 👂 Property lists are a common format for data storage in UserDefaults, and Codable can be used to convert custom structs into property list format.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: What are some ways to store data persistently in iOS?

Data can be stored in the file system, SQL databases, iCloud, or by using third-party options such as network databases.

Q: What are the limitations of UserDefaults?

UserDefaults is limited in the types of data it can store; it can only store basic types like strings, integers, booleans, dates, and arrays.

Q: How can Codable be used with UserDefaults?

Codable can be used to convert a struct into a data object that can be stored in UserDefaults. By implementing the Encodable and Decodable protocols, the struct can be easily encoded into a property list format that is compatible with UserDefaults.

Q: How can gestures be handled in SwiftUI?

Gestures can be handled in SwiftUI by using the .gesture modifier and specifying the gesture to recognize. The .onEnded function can be used to handle the gesture when it ends, and .updating can be used to handle the gesture as it is occurring.

Summary & Key Takeaways

  • UserDefaults is a lightweight, persistent store in iOS that can be used to store data persistently, although it is best suited for small user preferences.

  • To store data in UserDefaults, use the set(forKey:) function, specifying the object and key. To retrieve data, use functions like integer(forKey:), data(forKey:), and stringArray(forKey:).

  • Gestures in SwiftUI allow you to get input from the user using their fingers. Use the .gesture modifier to make a view recognize a gesture, and use functions like .onEnded to handle the gesture.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from Stanford 📚

Student Robot Moves Toward A Business thumbnail
Student Robot Moves Toward A Business
Stanford
Lecture 2 | The Fourier Transforms and its Applications thumbnail
Lecture 2 | The Fourier Transforms and its Applications
Stanford
Lecture 4 | Machine Learning (Stanford) thumbnail
Lecture 4 | Machine Learning (Stanford)
Stanford
Consciousness, a Quantum Physics Perspective thumbnail
Consciousness, a Quantum Physics Perspective
Stanford
Lecture 5 | Modern Physics: Quantum Mechanics (Stanford) thumbnail
Lecture 5 | Modern Physics: Quantum Mechanics (Stanford)
Stanford
Einstein's General Theory of Relativity | Lecture 3 thumbnail
Einstein's General Theory of Relativity | Lecture 3
Stanford

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots

Company

  • About us
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.