Firebase SwiftUI UIKit CoreData Revenue Cat Open AI Extensions CloudKit

Firebase

Firebase

Firebase is Google's BAS. Pocket AI incorporates seven Firebase features to enhance its functionality. Firstly, Firebase authentication is utilized to identify users through their Apple Accounts using the "Sign in with Apple" button. This authentication process seamlessly integrates with Revenue Cat for purchases, Open AI for API protection, and Firebase itself for efficient data management. Secondly, Pocket AI employs Firestore for real-time data storage. User information, including their name and ID, as well as the number of words remaining, is stored in Firestore. This approach enables users to access their accounts from any device while ensuring that the words remaining cannot be manipulated on the client side. Thirdly, Pocket AI leverages Firebase Cloud Functions. Specifically, two cloud functions are employed: one for storing the "Sign in with Apple" token and another for revoking it. This functionality is crucial for allowing users to delete their accounts directly within the app. Additionally, App Check is utilized to verify each request, bolstering security. Next, Pocket AI utilizes remote config for A/B testing purposes. This feature allows for seamless experimentation and evaluation of different app configurations to enhance user experience. Lastly, Pocket AI integrates Firebase analytics to measure user retention and track the usage of various features. And also crashlytics, to monitor crashes and app performance. This valuable data provides insights into user behavior and helps improve the overall performance of the app.

SwiftUI

SwiftUI

SwiftUI is Apple's declaritive UI framework and its used all throughout Pocket AI. Pocket AI is built on SwiftUI and requires much less code than its UI counterpart, UIKit. SwiftUI aslo made it much easier to target multiple apps in the same project. For example, Pocket AI targets both ios and macos using the same SwiftUI components.

UIKit

UIKit

UIKit is Apple's imperative UI framework that offers much greater support for legacy features due to its longer life compared to the newer SwiftUI. UIKit was used many times throughout Pocket AI to enable features such as Sign in with Apple, share sheets, audio and video player, and much more.

CoreData

CoreData

CoreData is Apple's device storage framework that is used as the backbone of Pocket AI when it comes to managing messaging data. Pocket AI uses NSPersistantCloudKitContainer to effortlessly sync up Cloudkit with CoreData to create a seamless experience for the user. Pocket AI also takes advantage of CoreSpotlight which indexes CoreData to be searched for in Spotlight Search. The object graph for Pocket AI is very simple with messages only storing a date and a string.

Revenue Cat

Revenue Cat

Revenue Cat is another dependency in Pocket AI that effortlessly handles StoreKit transactions. Pocket AI uses Revenue Cat to handle purchases for word recharges (consumables) and Pro (subscription). Pocket AI does not implement a restore purchase button because each user must first sign in with apple to use the app. The identifier provided by Apple is used to match each user to their Revenue Cat purchases.

Open AI

Open AI

Open AI is the company that runs the core API behind Pocket AI. Pocket AI uses the gpt-3.5 turbo model with a max token count of 4k or 16k depending on the context. Pocket AI also uses the streaming feature from Open AI to stream each word in the response as data. This allows for not only the immediate response times instead of waiting around for the complete message to send, but also adds a very neat effect similar to chat gpt. Functions have also been integrated to allow for custom actions from the AI such as getting weather, sending messages, or setting reminders.

Extensions

Extensions

Pocket AI comes with many extensions allowing for several ways to interact with the app from many places throughout your devices. First it uses an iMessage app to ask questions or reword text and insert into iMessage chats. Second, shortcuts and Siri integration to ask Siri or schedule shortcuts to Pocket AI questions. Third, a share extension to highlight text anywhere on your device and tap share to send the text as a question to Pocket AI. Fourth, use the keyboard extension to Pocket AI questions from any app or rephrase your text to match any tone. Fith, use the new Watch app to Pocket AI questions from your wrist. Sixth, Use the Watch compilation to quickly ask the AI a question from the watch face. Seventh, Use lock screen widgets to create a shortcut to your favorite chat room.

Cloudkit

CloudKit

Cloudkit is Apple's BAS (backend as a service) framework that manages all of Pocket AI's personalities. Cloudkit is a very safe option as it is essentially free. It allows me to update, add, or remove Pocket AI personalities on the fly.