GithubHelp home page GithubHelp logo

petequotes's Introduction

Pete's Quotes

This repository contains an Xcode project for an app and its widget called "Pete's Quotes". The app uses a free famous quote service to display the quotation and author as a widget. Once the quotes are fetched, the widget randomly displays one every so often (as set by the app).

Unlike most apps, the focus here is on the widget. The app just provides some customization of the widget. If you want to add a widget to your app, this is a good place to start as I cover the basics.

You can find out more on my blog at https://www.keaura.com/blog/widgets-with-swiftui.

The project has two targets: the app and the widget. This project shows you:

  • How to create a widget target in your project.
  • How to share code between your app and your widget.
  • How to share data between your app and your target.
  • How to support different widget sizes.
  • How to make remote calls from a widget.
  • A tip about a bug or two you are likely to encounter.

You will need Xcode 12.2 and a device running iOS 14. You can use the simulators but I've found it more reliable to run on an actual device.

The app and widget use Alamofire to handle the remote call and data; you can use URLSession if you prefer. It is only a single call and response. I just using Alamofire.

Once you've got the project and built it, you run the widget using its own Xcode scheme, PetesQuotes_WidgetExtension. This will install the widget in the simulator or device. You can stop the task once it has been started.

Give the blog article a read to get more insight.

petequotes's People

Contributors

peterent avatar

Stargazers

Ritesh Ranjan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.