Skip to content

Commit df4283f

Browse files
Merge pull request #12 from DevCrew-io/feat/sample-mvvm
Feat/sample mvvm
2 parents 785d438 + f892fa9 commit df4283f

File tree

29 files changed

+2246
-0
lines changed

29 files changed

+2246
-0
lines changed

Example/Example.xcodeproj/project.pbxproj

+748
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"pins" : [
3+
{
4+
"identity" : "chatgpt-ios-sdk",
5+
"kind" : "remoteSourceControl",
6+
"location" : "https://github.com/DevCrew-io/chatgpt-ios-sdk.git",
7+
"state" : {
8+
"revision" : "a418649bbe3de4c90d02d1975cb1280d3366b144",
9+
"version" : "1.0.0"
10+
}
11+
}
12+
],
13+
"version" : 2
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Bucket
3+
uuid = "A1ED0C29-5AB9-4530-B5C4-AA89084510A9"
4+
type = "1"
5+
version = "2.0">
6+
</Bucket>

Example/Example/App/AppDelegate.swift

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// AppDelegate.swift
3+
// Example
4+
//
5+
// Created by Ghullam Abbas on 21/06/2023.
6+
//
7+
8+
import UIKit
9+
10+
@main
11+
class AppDelegate: UIResponder, UIApplicationDelegate {
12+
13+
14+
15+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
16+
// Override point for customization after application launch.
17+
return true
18+
}
19+
20+
// MARK: UISceneSession Lifecycle
21+
22+
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
23+
// Called when a new scene session is being created.
24+
// Use this method to select a configuration to create the new scene with.
25+
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
26+
}
27+
28+
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
29+
// Called when the user discards a scene session.
30+
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
31+
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
32+
}
33+
34+
35+
}
36+
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//
2+
// SceneDelegate.swift
3+
// Example
4+
//
5+
// Created by Ghullam Abbas on 21/06/2023.
6+
//
7+
8+
import UIKit
9+
10+
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
11+
12+
var window: UIWindow?
13+
14+
15+
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
16+
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
17+
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
18+
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
19+
guard let _ = (scene as? UIWindowScene) else { return }
20+
}
21+
22+
func sceneDidDisconnect(_ scene: UIScene) {
23+
// Called as the scene is being released by the system.
24+
// This occurs shortly after the scene enters the background, or when its session is discarded.
25+
// Release any resources associated with this scene that can be re-created the next time the scene connects.
26+
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
27+
}
28+
29+
func sceneDidBecomeActive(_ scene: UIScene) {
30+
// Called when the scene has moved from an inactive state to an active state.
31+
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
32+
}
33+
34+
func sceneWillResignActive(_ scene: UIScene) {
35+
// Called when the scene will move from an active state to an inactive state.
36+
// This may occur due to temporary interruptions (ex. an incoming phone call).
37+
}
38+
39+
func sceneWillEnterForeground(_ scene: UIScene) {
40+
// Called as the scene transitions from the background to the foreground.
41+
// Use this method to undo the changes made on entering the background.
42+
}
43+
44+
func sceneDidEnterBackground(_ scene: UIScene) {
45+
// Called as the scene transitions from the foreground to the background.
46+
// Use this method to save data, release shared resources, and store enough scene-specific state information
47+
// to restore the scene back to its current state.
48+
}
49+
50+
51+
}
52+
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// MessageModel.swift
3+
// Example
4+
//
5+
// Created by Ghullam Abbas on 22/06/2023.
6+
//
7+
8+
import Foundation
9+
10+
struct ChatMessage: Codable {
11+
let content: String
12+
let role: String
13+
}
14+
15+
enum Role: String, Codable {
16+
case user = "user"
17+
case assistant = "assistant"
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
6+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
7+
</dependencies>
8+
<scenes>
9+
<!--View Controller-->
10+
<scene sceneID="EHf-IW-A2E">
11+
<objects>
12+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
13+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
14+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
15+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16+
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
17+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
18+
</view>
19+
</viewController>
20+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
21+
</objects>
22+
<point key="canvasLocation" x="53" y="375"/>
23+
</scene>
24+
</scenes>
25+
</document>

0 commit comments

Comments
 (0)