Sagun Raj Lage and Prakshapan Shrestha
Getting Started with WidgetKit
Create Widgets for iOS and iPadOS
1st ed.
Logo of the publisher
Sagun Raj Lage
Golmadhi, Nepal
Prakshapan Shrestha
Tokha, Nepal
Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the books product page, located at www.apress.com/978-1-4842-7041-7 . For more detailed information, please visit http://www.apress.com/source-code .
ISBN 978-1-4842-7041-7 e-ISBN 978-1-4842-7042-4
https://doi.org/10.1007/978-1-4842-7042-4
Apress standard
Sagun Raj Lage and Prakshapan Shrestha 2021
This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
This Apress imprint is published by the registered company APress Media, LLC part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY 10004, U.S.A.
To my father, late Shree Ram Lage, my role model, my inspiration, my pride, who taught me what duties and responsibilities mean. I hope I am making you proud, Baba.
To my mother, Jamuna Laxmi Sitikhu (Lage), my support system, who has befriended struggles and has taught me to bravely face challenges. I know youve made many sacrifices to make me who I am today, Mamu.
To my little sister, Sarina Lage, who has always been there for me in my highs and lows, joys and sorrows. And I know youll be there for me in the days to come too. I love you.
To my grandparents, Ganga Laxmi Sitikhu and Narayan Bhakta Sitikhu, who have always showered me with their precious blessings and unconditional love.
To my uncles and aunts, Narayan Prasad Sitikhu and Ram Devi Sitikhu, Sunil Kharbuja and Srijana Kharbuja, Krishna Prasad Bohaju and Rejina Bohaju, for wholeheartedly providing their guidance and love to me.
To the person who lit the spark of interest in computers, gadgets, and technology in me since my childhood my uncle, Jibesh Sitikhu. I wouldnt be where I am today without your contributions, your teachings, your talks and without breaking down your computer many times. And to my aunt, Rajyashwori Sitikhu. Youre an epitome of kindness and affection.
To my lovely cousins, Bigyan Sitikhu, Sachin Bohaju, Binam Sitikhu, Salin Bohaju, Shrijal Kharbuja, Jibisha Sitikhu, Swornim Kharbuja, Jibika Sitikhu, Raunak Sitikhu, and Raunika Sitikhu. You have filled my life with joy. I love you all.
To my brother from another mother, Kshitij Raj Lohani, who has always helped me selflessly and who allowed me to access and use his personal MacBook Pro in the United States, from Nepal, for almost a year. I was able to join an iOS bootcamp, write blogs on iOS development, and write this book just because he allowed me to use his computer as I couldnt afford one.
To all my teachers, seniors, mentors, friends, and juniors. You are my gems. I feel blessed to have you in life. Thank you for everything!
Sagun Raj Lage
To my dear mother.
Prakshapan Shrestha
Before You Begin
Before you start exploring the beauty and power of WidgetKit through this book, you will need to make sure you have the following prerequisites set up:
A Mac running macOS Catalina (version 10.15.4) or later: However, we recommend a Mac running macOS Big Sur (version 11) or later as the code was tested on that version.
Xcode 12 or later: Xcode is the primary tool used to develop apps for the Apple ecosystem. You can download the latest version of Xcode from Apples developer site. We recommend using Xcode 12.4 or later as the code was tested on that version.
Swift 5 or later: Since the new versions of Xcode ship with the updated versions of Swift, you need not worry about this.
Simulators and devices with iOS 14 or later installed since the WidgetKit framework, the framework you will use to develop widgets, is only supported from iOS 14.
A Twitter Developer Account: In the last chapter of this book, you will develop a widget that will use Twitters API. And you will get access to Twitters API only after you own a Twitter Developer Account. You can apply for a developer account from Twitters developer account page.
Generally, it takes a day or two, or sometimes even more, for Twitter to review your application and approve or reject it. Therefore, it is a nice idea to apply for that account before beginning this book so that when you reach the last chapter, your Twitter Developer Account will be ready to use.
Table of Contents
About the Authors
Sagun Raj Lage
started his professional career in software development as a Full Stack Web Developer and later moved into developing iOS applications. He has been a part of development teams on applications used in fields such as transportation, multimedia, shopping, finance, astrology, and management. He is actively involved in organizing developer events and in contributing as a mentor and tutor in programming bootcamps. Apart from software development and programming, he enjoys reading and writing blogs, music, graphic design, and video editing.
Prakshapan Shrestha
is an entrepreneurial app developer with 6 years of iOS development experience. He devoutly follows the latest tools and technologies that make a developers life easier and actively helps out budding developers. Aside from software development, Prakshapan enjoys hiking and heading his recent venture, Pregasathi, which provides new families in need of baby products with help.
About the Technical Reviewer
Felipe Laso
is a Senior Systems Engineer working at Lextech Global Services. Hes also an aspiring game designer/programmer. You can follow him on Twitter at @iFeliLM or on his blog.
Footnotes
https://developer.apple.com/xcode/
https://developer.twitter.com/en/apply-for-access