├── .env ├── SwiftGPT ├── Assets.xcassets │ ├── Contents.json │ ├── gpt-logo.imageset │ │ ├── chat-gpt-logo.jpg │ │ └── Contents.json │ ├── person-icon.imageset │ │ ├── person-icon.png │ │ └── Contents.json │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── appBackgroundColor.colorset │ │ └── Contents.json │ ├── userMessageBackground.colorset │ │ └── Contents.json │ ├── responseMessageBackground.colorset │ │ └── Contents.json │ └── textFieldBackgroundColor.colorset │ │ └── Contents.json ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── App │ ├── SwiftGPTApp.swift │ └── ContentView.swift ├── Models │ └── Message.swift ├── Utils │ ├── Extensions │ │ ├── Shadow+Extension.swift │ │ └── Spacing+Extension.swift │ └── Config │ │ └── Config.swift ├── Views │ ├── Messages │ │ ├── MessageIndicatorView.swift │ │ └── MessageView.swift │ ├── MessageInputArea.swift │ ├── ChatGPTView.swift │ └── DalleView.swift └── ViewModels │ ├── GPTViewModel.swift │ └── DalleViewModel.swift ├── Resources └── Localizables │ ├── swiftgen.yml │ ├── Localizable.strings │ └── Strings+Generated.swift ├── SwiftGPT-Info.plist ├── SwiftGPT.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── swiftpm │ │ └── Package.resolved └── project.pbxproj ├── .gitignore ├── SwiftGPTTests ├── GPTViewModelTests.swift ├── DalleViewModelTests.swift └── MessageTests.swift ├── .github └── workflows │ ├── pr-ci.yml │ └── claude-auto-review.yml ├── README.md ├── .swiftlint.yml └── LICENSE /.env: -------------------------------------------------------------------------------- 1 | export OPENAI_API_KEY=YOUR_API_KEY 2 | -------------------------------------------------------------------------------- /SwiftGPT/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SwiftGPT/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SwiftGPT/Assets.xcassets/gpt-logo.imageset/chat-gpt-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbabicz/SwiftGPT/HEAD/SwiftGPT/Assets.xcassets/gpt-logo.imageset/chat-gpt-logo.jpg -------------------------------------------------------------------------------- /SwiftGPT/Assets.xcassets/person-icon.imageset/person-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbabicz/SwiftGPT/HEAD/SwiftGPT/Assets.xcassets/person-icon.imageset/person-icon.png -------------------------------------------------------------------------------- /Resources/Localizables/swiftgen.yml: -------------------------------------------------------------------------------- 1 | strings: 2 | inputs: 3 | - Localizable.strings 4 | outputs: 5 | - templateName: structured-swift5 6 | output: Strings+Generated.swift 7 | -------------------------------------------------------------------------------- /SwiftGPT-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SwiftGPT.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftGPT/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # User-specific files 2 | *.xcuserstate 3 | xcuserdata/ 4 | 5 | # Xcode cache 6 | DerivedData/ 7 | *.lock 8 | *.xcscmblueprint 9 | profile 10 | .idea/ 11 | 12 | # system files 13 | .DS_Store 14 | 15 | # Secrets 16 | Secrets.swift 17 | **/Secrets.swift -------------------------------------------------------------------------------- /SwiftGPT/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "platform" : "ios", 6 | "size" : "1024x1024" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SwiftGPT.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftGPT/App/SwiftGPTApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftGPTApp.swift 3 | // SwiftGPT 4 | // 5 | // Created by mbabicz on 07/02/2023. 6 | // 7 | 8 | import SwiftUI 9 | import SFSafeSymbols 10 | 11 | @main 12 | struct SwiftGPT: App { 13 | 14 | var body: some Scene { 15 | WindowGroup { 16 | ContentView() 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SwiftGPT/Assets.xcassets/gpt-logo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "chat-gpt-logo.jpg", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftGPT/Assets.xcassets/person-icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "person-icon.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftGPT/Models/Message.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Message.swift 3 | // SwiftGPT 4 | // 5 | // Created by mbabicz on 17/02/2023. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | enum MessageContent: Equatable { 12 | case text(String) 13 | case image(Data) 14 | case indicator 15 | case error(String) 16 | } 17 | 18 | struct Message: Identifiable, Equatable { 19 | var id = UUID() 20 | var content: MessageContent 21 | let isUserMessage: Bool 22 | } 23 | -------------------------------------------------------------------------------- /SwiftGPT/App/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // SwiftGPT 4 | // 5 | // Created by mbabicz on 07/02/2023. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | 12 | var body: some View { 13 | TabView { 14 | ChatGPTView().tabItem { 15 | Label(L10n.Chatgpt.Tab.title, systemSymbol: .ellipsisBubble) 16 | } 17 | .accessibilityLabel(L10n.Accessibility.Tab.chatgpt) 18 | 19 | DalleView().tabItem { 20 | Label(L10n.Dalle.Tab.title, systemSymbol: .paintbrush) 21 | } 22 | .accessibilityLabel(L10n.Accessibility.Tab.dalle) 23 | } 24 | } 25 | } 26 | 27 | #Preview { 28 | ContentView() 29 | } 30 | -------------------------------------------------------------------------------- /SwiftGPT/Utils/Extensions/Shadow+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Shadow+Extension.swift 3 | // SwiftGPT 4 | // 5 | // Design System - Shadows 6 | // 7 | 8 | import SwiftUI 9 | 10 | extension View { 11 | // MARK: - Shadow Modifiers 12 | func appShadowSM() -> some View { 13 | shadow(color: .black.opacity(0.1), radius: 0.5, x: 0, y: 1) 14 | } 15 | 16 | func appShadowMD() -> some View { 17 | shadow(color: .black.opacity(0.15), radius: 2, x: 0, y: 2) 18 | } 19 | 20 | func appShadowLG() -> some View { 21 | shadow(color: .black.opacity(0.2), radius: 4, x: 0, y: 4) 22 | } 23 | 24 | func appShadowColored(_ color: Color, radius: CGFloat = 1) -> some View { 25 | shadow(color: color, radius: radius) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SwiftGPT/Assets.xcassets/appBackgroundColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "33", 9 | "green" : "33", 10 | "red" : "33" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | }, 15 | { 16 | "appearances" : [ 17 | { 18 | "appearance" : "luminosity", 19 | "value" : "dark" 20 | } 21 | ], 22 | "color" : { 23 | "color-space" : "srgb", 24 | "components" : { 25 | "alpha" : "1.000", 26 | "blue" : "33", 27 | "green" : "33", 28 | "red" : "33" 29 | } 30 | }, 31 | "idiom" : "universal" 32 | } 33 | ], 34 | "info" : { 35 | "author" : "xcode", 36 | "version" : 1 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SwiftGPT/Assets.xcassets/userMessageBackground.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "48", 9 | "green" : "48", 10 | "red" : "48" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | }, 15 | { 16 | "appearances" : [ 17 | { 18 | "appearance" : "luminosity", 19 | "value" : "dark" 20 | } 21 | ], 22 | "color" : { 23 | "color-space" : "srgb", 24 | "components" : { 25 | "alpha" : "1.000", 26 | "blue" : "48", 27 | "green" : "48", 28 | "red" : "48" 29 | } 30 | }, 31 | "idiom" : "universal" 32 | } 33 | ], 34 | "info" : { 35 | "author" : "xcode", 36 | "version" : 1 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SwiftGPT/Assets.xcassets/responseMessageBackground.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "68", 9 | "green" : "68", 10 | "red" : "68" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | }, 15 | { 16 | "appearances" : [ 17 | { 18 | "appearance" : "luminosity", 19 | "value" : "dark" 20 | } 21 | ], 22 | "color" : { 23 | "color-space" : "srgb", 24 | "components" : { 25 | "alpha" : "1.000", 26 | "blue" : "68", 27 | "green" : "68", 28 | "red" : "68" 29 | } 30 | }, 31 | "idiom" : "universal" 32 | } 33 | ], 34 | "info" : { 35 | "author" : "xcode", 36 | "version" : 1 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SwiftGPT/Assets.xcassets/textFieldBackgroundColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "48", 9 | "green" : "48", 10 | "red" : "48" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | }, 15 | { 16 | "appearances" : [ 17 | { 18 | "appearance" : "luminosity", 19 | "value" : "dark" 20 | } 21 | ], 22 | "color" : { 23 | "color-space" : "srgb", 24 | "components" : { 25 | "alpha" : "1.000", 26 | "blue" : "48", 27 | "green" : "48", 28 | "red" : "48" 29 | } 30 | }, 31 | "idiom" : "universal" 32 | } 33 | ], 34 | "info" : { 35 | "author" : "xcode", 36 | "version" : 1 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SwiftGPTTests/GPTViewModelTests.swift: -------------------------------------------------------------------------------- 1 | import Testing 2 | @testable import SwiftGPT 3 | 4 | @Suite("GPT ViewModel Tests") 5 | struct GPTViewModelTests { 6 | 7 | @Test("Initial state is empty") 8 | func initialState() { 9 | let viewModel = GPTViewModel() 10 | 11 | #expect(viewModel.messages.isEmpty) 12 | #expect(viewModel.typingMessage.isEmpty) 13 | #expect(viewModel.isLoading == false) 14 | } 15 | 16 | @Test("Empty message not sent") 17 | func emptyMessageNotSent() { 18 | let viewModel = GPTViewModel() 19 | viewModel.typingMessage = "" 20 | 21 | viewModel.sendMessage() 22 | 23 | #expect(viewModel.messages.isEmpty) 24 | } 25 | 26 | @Test("Whitespace message not sent") 27 | func whitespaceMessageNotSent() { 28 | let viewModel = GPTViewModel() 29 | viewModel.typingMessage = " " 30 | 31 | viewModel.sendMessage() 32 | 33 | #expect(viewModel.messages.isEmpty) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SwiftGPTTests/DalleViewModelTests.swift: -------------------------------------------------------------------------------- 1 | import Testing 2 | @testable import SwiftGPT 3 | 4 | @Suite("DALL-E ViewModel Tests") 5 | struct DalleViewModelTests { 6 | 7 | @Test("Initial state is empty") 8 | func initialState() { 9 | let viewModel = DalleViewModel() 10 | 11 | #expect(viewModel.messages.isEmpty) 12 | #expect(viewModel.typingMessage.isEmpty) 13 | #expect(viewModel.isLoading == false) 14 | } 15 | 16 | @Test("Empty message not sent") 17 | func emptyMessageNotSent() { 18 | let viewModel = DalleViewModel() 19 | viewModel.typingMessage = "" 20 | 21 | viewModel.sendMessage() 22 | 23 | #expect(viewModel.messages.isEmpty) 24 | } 25 | 26 | @Test("Whitespace message not sent") 27 | func whitespaceMessageNotSent() { 28 | let viewModel = DalleViewModel() 29 | viewModel.typingMessage = " " 30 | 31 | viewModel.sendMessage() 32 | 33 | #expect(viewModel.messages.isEmpty) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SwiftGPT/Views/Messages/MessageIndicatorView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageIndicatorView.swift 3 | // SwiftGPT 4 | // 5 | // Created by mbabicz on 06/02/2023. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct MessageIndicatorView: View { 11 | var body: some View { 12 | HStack { 13 | DotView() 14 | DotView(delay: 0.2) 15 | DotView(delay: 0.4) 16 | } 17 | .padding(.appSpacingMD) 18 | .background(Color.gray.opacity(0.25)) 19 | .cornerRadius(.appCornerRadiusFull) 20 | } 21 | } 22 | 23 | struct DotView: View { 24 | @State private var scale: CGFloat = 0.5 25 | var delay: Double = 0 26 | 27 | var body: some View { 28 | Circle() 29 | .frame(width: 7, height: 7) 30 | .scaleEffect(scale) 31 | .onAppear { 32 | withAnimation(Animation.easeInOut.repeatForever().delay(delay)) { 33 | self.scale = 1 34 | } 35 | } 36 | } 37 | } 38 | 39 | #Preview { 40 | MessageIndicatorView() 41 | } 42 | -------------------------------------------------------------------------------- /Resources/Localizables/Localizable.strings: -------------------------------------------------------------------------------- 1 | "chatgpt.tab.title" = "CHAT BOT"; 2 | "dalle.tab.title" = "DALL·E 2"; 3 | "dalle.error.image_conversion" = "Image conversion error"; 4 | "message.textfield.placeholder" = "Message..."; 5 | "chat.introduce.title" = "Write your first message!"; 6 | "error.network" = "Network error occurred"; 7 | "error.api" = "API request failed"; 8 | "error.unknown" = "An unexpected error occurred"; 9 | "error.save_photo" = "Failed to save image to Photos"; 10 | "error.save_photo_permission" = "Permission denied. Please allow access to Photos in Settings."; 11 | 12 | // Accessibility 13 | "accessibility.tab.chatgpt" = "Chat with GPT"; 14 | "accessibility.tab.dalle" = "Generate images with DALL·E"; 15 | "accessibility.button.send" = "Send message"; 16 | "accessibility.button.send.hint" = "Sends your message to the AI"; 17 | "accessibility.button.share" = "Share image"; 18 | "accessibility.button.save" = "Save image to photos"; 19 | "accessibility.textfield.message" = "Message input field"; 20 | "accessibility.image.generated" = "Generated image"; 21 | "accessibility.image.user" = "User avatar"; 22 | "accessibility.image.gpt" = "AI avatar"; 23 | -------------------------------------------------------------------------------- /SwiftGPT/Utils/Extensions/Spacing+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Spacing+Extension.swift 3 | // SwiftGPT 4 | // 5 | // Design System - Spacing 6 | // 7 | 8 | import SwiftUI 9 | 10 | extension CGFloat { 11 | // MARK: - Spacing Scale 12 | static let appSpacingXS: CGFloat = 4 13 | static let appSpacingSM: CGFloat = 8 14 | static let appSpacingMD: CGFloat = 12 15 | static let appSpacingLG: CGFloat = 16 16 | static let appSpacingXL: CGFloat = 20 17 | static let appSpacing2XL: CGFloat = 24 18 | static let appSpacing3XL: CGFloat = 32 19 | 20 | // MARK: - Corner Radius Scale 21 | static let appCornerRadiusXS: CGFloat = 4 22 | static let appCornerRadiusSM: CGFloat = 8 23 | static let appCornerRadiusMD: CGFloat = 12 24 | static let appCornerRadiusLG: CGFloat = 13 25 | static let appCornerRadiusXL: CGFloat = 16 26 | static let appCornerRadius2XL: CGFloat = 20 27 | static let appCornerRadiusFull: CGFloat = 25 28 | 29 | // MARK: - Icon Sizes 30 | static let appIconXS: CGFloat = 16 31 | static let appIconSM: CGFloat = 20 32 | static let appIconMD: CGFloat = 24 33 | static let appIconLG: CGFloat = 30 34 | static let appIconXL: CGFloat = 40 35 | } 36 | -------------------------------------------------------------------------------- /SwiftGPT/Utils/Config/Config.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Config.swift 3 | // SwiftGPT 4 | // 5 | // Application configuration constants 6 | // 7 | 8 | import Foundation 9 | 10 | enum Config { 11 | // MARK: - Messages 12 | enum Messages { 13 | /// Maximum number of messages to keep in memory 14 | static let maxMessages = 100 15 | } 16 | 17 | // MARK: - DALL-E 18 | enum Dalle { 19 | /// Default image resolution for DALL-E generations 20 | /// Use .small (256x256), .medium (512x512), or .large (1024x1024) 21 | static let imageResolutionString = "512x512" 22 | 23 | /// Response format for DALL-E API 24 | /// Use "url" or "b64_json" 25 | static let responseFormatString = "b64_json" 26 | } 27 | 28 | // MARK: - User Interface 29 | enum UserInterface { 30 | /// Maximum lines for text input field 31 | static let textFieldMaxLines = 3 32 | 33 | /// Avatar icon size 34 | static let avatarSize: CGFloat = .appIconLG 35 | 36 | /// Input area corner radius 37 | static let inputCornerRadius: CGFloat = .appCornerRadiusMD 38 | 39 | /// Generated image corner radius 40 | static let imageCornerRadius: CGFloat = .appCornerRadiusLG 41 | } 42 | 43 | // MARK: - API 44 | enum API { 45 | /// OpenAI organization ID 46 | static let organizationId = "Personal" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SwiftGPTTests/MessageTests.swift: -------------------------------------------------------------------------------- 1 | import Testing 2 | import SwiftUI 3 | @testable import SwiftGPT 4 | 5 | @Suite("Message Tests") 6 | struct MessageTests { 7 | 8 | @Test("Message has unique ID") 9 | func messageUniqueID() { 10 | let message1 = Message(content: .text("Hello"), isUserMessage: true) 11 | let message2 = Message(content: .text("Hello"), isUserMessage: true) 12 | 13 | #expect(message1.id != message2.id) 14 | } 15 | 16 | @Test("Text message content") 17 | func textMessageContent() { 18 | let message = Message(content: .text("Test"), isUserMessage: false) 19 | 20 | if case let .text(content) = message.content { 21 | #expect(content == "Test") 22 | } else { 23 | Issue.record("Expected text content") 24 | } 25 | } 26 | 27 | @Test("Error message content") 28 | func errorMessageContent() { 29 | let message = Message(content: .error("Error"), isUserMessage: false) 30 | 31 | if case let .error(content) = message.content { 32 | #expect(content == "Error") 33 | } else { 34 | Issue.record("Expected error content") 35 | } 36 | } 37 | 38 | @Test("Indicator message content") 39 | func indicatorMessageContent() { 40 | let message = Message(content: .indicator, isUserMessage: false) 41 | 42 | #expect(message.content == .indicator) 43 | } 44 | 45 | @Test("Image message content") 46 | func imageMessageContent() { 47 | let imageData = Data([0x00, 0x01, 0x02]) 48 | let message = Message(content: .image(imageData), isUserMessage: false) 49 | 50 | if case let .image(data) = message.content { 51 | #expect(data == imageData) 52 | } else { 53 | Issue.record("Expected image content") 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SwiftGPT/Views/MessageInputArea.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageInputArea.swift 3 | // SwiftGPT 4 | // 5 | // Created by Michał Babicz on 04/04/2025. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct MessageInputArea: View { 11 | @Binding var text: String 12 | var placeholder: String 13 | var onSend: () -> Void 14 | var isSendEnabled: Bool = true 15 | var isFocusedBinding: FocusState.Binding 16 | 17 | var body: some View { 18 | HStack(alignment: .center) { 19 | TextField(placeholder, text: $text, axis: .vertical) 20 | .focused(isFocusedBinding) 21 | .padding(.appSpacingMD) 22 | .foregroundStyle(.white) 23 | .lineLimit(Config.UserInterface.textFieldMaxLines) 24 | .disableAutocorrection(true) 25 | .autocapitalization(.none) 26 | .keyboardType(.alphabet) 27 | .accessibilityLabel(L10n.Accessibility.Textfield.message) 28 | 29 | Button { 30 | isFocusedBinding.wrappedValue = false 31 | onSend() 32 | } label: { 33 | Image(systemSymbol: text.isEmpty ? .circle : .paperplaneFill) 34 | .resizable() 35 | .scaledToFit() 36 | .foregroundStyle(text.isEmpty ? .white.opacity(0.75) : .white) 37 | .frame(width: .appIconSM, height: .appIconSM) 38 | .padding(.appSpacingMD) 39 | } 40 | .disabled(!isSendEnabled) 41 | .accessibilityLabel(L10n.Accessibility.Button.send) 42 | .accessibilityHint(L10n.Accessibility.Button.Send.hint) 43 | } 44 | .background(.textFieldBackground) 45 | .cornerRadius(Config.UserInterface.inputCornerRadius) 46 | .padding([.leading, .trailing, .bottom], .appSpacingSM) 47 | .appShadowSM() 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /.github/workflows/pr-ci.yml: -------------------------------------------------------------------------------- 1 | name: PR CI – build only 2 | 3 | on: 4 | pull_request: 5 | types: [opened, synchronize, reopened, ready_for_review] 6 | 7 | concurrency: 8 | group: pr-ci-${{ github.ref }} 9 | cancel-in-progress: true 10 | 11 | jobs: 12 | build: 13 | runs-on: macos-latest 14 | timeout-minutes: 25 15 | if: github.event.pull_request.user.login == 'mbabicz' 16 | 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v4 20 | 21 | - name: Select Xcode latest stable 22 | uses: maxim-lobanov/setup-xcode@v1 23 | with: 24 | xcode-version: 'latest-stable' 25 | 26 | - name: Install SwiftLint 27 | run: brew install swiftlint 28 | 29 | - name: Run SwiftLint 30 | run: swiftlint lint --strict 31 | 32 | - name: Clean DerivedData / SPM build dirs 33 | run: | 34 | rm -rf ~/Library/Developer/Xcode/DerivedData 35 | rm -rf .build 36 | 37 | - name: Create dummy Secrets.swift for CI 38 | run: | 39 | cat > SwiftGPT/Secrets.swift << 'EOF' 40 | // 41 | // Secrets.swift 42 | // SwiftGPT - CI Build 43 | // 44 | 45 | import Foundation 46 | 47 | enum Secrets { 48 | static let openaiApiKey = "dummy-key-for-ci-build" 49 | } 50 | EOF 51 | 52 | - name: Resolve packages 53 | run: | 54 | set -euo pipefail 55 | xcodebuild -resolvePackageDependencies \ 56 | -project SwiftGPT.xcodeproj \ 57 | -scheme "SwiftGPT" 58 | 59 | - name: Build (no code signing) 60 | run: | 61 | set -euo pipefail 62 | xcodebuild \ 63 | -project SwiftGPT.xcodeproj \ 64 | -scheme "SwiftGPT" \ 65 | -configuration Debug \ 66 | -sdk iphonesimulator \ 67 | CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO \ 68 | build -------------------------------------------------------------------------------- /SwiftGPT/Views/ChatGPTView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChatGPTView.swift 3 | // SwiftGPT 4 | // 5 | // Created by mbabicz on 25/01/2023. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ChatGPTView: View { 11 | @StateObject private var viewModel = GPTViewModel() 12 | @FocusState private var isFocused: Bool 13 | 14 | var body: some View { 15 | NavigationStack { 16 | VStack(alignment: .leading) { 17 | messagesView 18 | MessageInputArea( 19 | text: $viewModel.typingMessage, 20 | placeholder: L10n.Message.Textfield.placeholder, 21 | onSend: viewModel.sendMessage, 22 | isSendEnabled: !viewModel.isLoading && !viewModel.typingMessage.isEmpty, 23 | isFocusedBinding: $isFocused 24 | ) 25 | } 26 | .background(.appBackground) 27 | .onTapGesture { isFocused = false } 28 | .navigationTitle(L10n.Chatgpt.Tab.title) 29 | .navigationBarTitleDisplayMode(.inline) 30 | } 31 | } 32 | 33 | // MARK: - Private Views 34 | private var messagesView: some View { 35 | Group { 36 | if viewModel.messages.isEmpty { 37 | emptyStateView 38 | } else { 39 | messagesScrollView 40 | } 41 | } 42 | } 43 | 44 | private var messagesScrollView: some View { 45 | ScrollViewReader { reader in 46 | ScrollView { 47 | ForEach(viewModel.messages) { message in 48 | MessageView(message: message) 49 | } 50 | Text("").id(viewModel.bottomID) 51 | } 52 | .onChange(of: viewModel.messages.count) { _ in 53 | withAnimation { reader.scrollTo(viewModel.bottomID) } 54 | } 55 | .onAppear { withAnimation { reader.scrollTo(viewModel.bottomID) } } 56 | } 57 | } 58 | 59 | private var emptyStateView: some View { 60 | VStack { 61 | Image(systemSymbol: .ellipsisBubble) 62 | .font(.largeTitle) 63 | Text(L10n.Chat.Introduce.title) 64 | .font(.subheadline) 65 | .padding(.appSpacingSM) 66 | } 67 | .frame(maxWidth: .infinity, maxHeight: .infinity) 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /.github/workflows/claude-auto-review.yml: -------------------------------------------------------------------------------- 1 | name: Claude Auto Review with Tracking 2 | 3 | on: 4 | pull_request: 5 | types: [opened, reopened] 6 | 7 | concurrency: 8 | group: claude-auto-review-${{ github.event.pull_request.number }} 9 | cancel-in-progress: true 10 | 11 | jobs: 12 | review: 13 | if: github.event.pull_request.draft == false && github.event.pull_request.user.login == 'mbabicz' 14 | runs-on: ubuntu-latest 15 | permissions: 16 | contents: read 17 | pull-requests: write 18 | id-token: write 19 | steps: 20 | - uses: actions/checkout@v4 21 | with: 22 | fetch-depth: 1 23 | 24 | - uses: anthropics/claude-code-action@v1 25 | with: 26 | anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} 27 | use_sticky_comment: true 28 | track_progress: true 29 | prompt: | 30 | You are an expert PR reviewer. Produce ONE top-level Markdown comment only (no inline code comments). 31 | OUTPUT STRUCTURE: 32 | 1) **Summary (2–4 sentences)** — Plain-language snapshot of what changed in this PR: scope, user-visible impact, main areas/files touched, and the riskiest part. 33 | 2) **Suggested manual checks** — Non-technical checklist for a tester to click through in the app. Use unchecked boxes only (`- [ ]`). Prefer concrete steps (where to tap/click, expected result). Cover happy path, key edge cases, nearby regressions, and basic cross-device/browser (if relevant). 34 | 3) **Findings** — Prioritized bullets on correctness, security, performance, tests, and DX. Use file:line hints like `path/to/file.ext:123` when specific. 35 | 4) **Action items** — Short, prioritized fixes. Include tiny diffs/snippets when helpful. 36 | RULES: 37 | - Do NOT post inline code comments. 38 | - Be precise and brief; no code repetition; no secrets. 39 | - If the diff is large, focus on highest-risk parts and test depth. 40 | CONTEXT: 41 | - REPO: ${{ github.repository }} 42 | - PR NUMBER: ${{ github.event.pull_request.number }} 43 | 44 | claude_args: | 45 | --model claude-sonnet-4-20250514 46 | --max-turns 3 47 | --system-prompt "Write a single top-level review as instructed in the user prompt. Do NOT post inline code comments." -------------------------------------------------------------------------------- /SwiftGPT/Views/DalleView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DalleView.swift 3 | // SwiftGPT 4 | // 5 | // Created by mbabicz on 06/02/2023. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct DalleView: View { 11 | @StateObject private var viewModel = DalleViewModel() 12 | @FocusState private var isFocused: Bool 13 | 14 | var body: some View { 15 | NavigationStack { 16 | VStack(alignment: .leading) { 17 | messagesView 18 | MessageInputArea( 19 | text: $viewModel.typingMessage, 20 | placeholder: L10n.Message.Textfield.placeholder, 21 | onSend: viewModel.sendMessage, 22 | isSendEnabled: !viewModel.isLoading && !viewModel.typingMessage.isEmpty, 23 | isFocusedBinding: $isFocused 24 | ) 25 | } 26 | .background(.appBackground) 27 | .onTapGesture { isFocused = false } 28 | .navigationTitle(L10n.Dalle.Tab.title) 29 | .navigationBarTitleDisplayMode(.inline) 30 | } 31 | } 32 | 33 | // MARK: - Message Views 34 | private var messagesView: some View { 35 | Group { 36 | if viewModel.messages.isEmpty { 37 | emptyStateView 38 | } else { 39 | messagesScrollView 40 | } 41 | } 42 | } 43 | 44 | private var messagesScrollView: some View { 45 | ScrollViewReader { reader in 46 | ScrollView { 47 | ForEach(viewModel.messages) { message in 48 | MessageView(message: message) 49 | } 50 | Text("").id(viewModel.bottomID) 51 | } 52 | .onAppear { 53 | scrollToBottom(with: reader) 54 | } 55 | .onChange(of: viewModel.messages.count) { _ in 56 | scrollToBottom(with: reader) 57 | } 58 | } 59 | } 60 | 61 | private var emptyStateView: some View { 62 | VStack { 63 | Image(systemSymbol: .paintbrush) 64 | .font(.largeTitle) 65 | Text(L10n.Chat.Introduce.title) 66 | .font(.subheadline) 67 | .padding(.appSpacingSM) 68 | } 69 | .frame(maxWidth: .infinity, maxHeight: .infinity) 70 | } 71 | 72 | private func scrollToBottom(with reader: ScrollViewProxy) { 73 | withAnimation { 74 | reader.scrollTo(viewModel.bottomID, anchor: .bottom) 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SwiftUI - ChatGPT and DALL·E 2 iOS 2 | 3 | [![mbabicz](https://img.shields.io/static/v1?label=mbabicz&message=SwiftGPT&color=green&logo=github)](https://github.com/mbabicz/SwiftGPT)
4 | [![stars](https://img.shields.io/github/stars/mbabicz/SwiftUI-ChatGPT-DALL-E-2?style=social)](https://github.com/mbabicz/SwiftGPT) 5 | [![forks](https://img.shields.io/github/forks/mbabicz/SwiftUI-ChatGPT-DALL-E-2?style=social)](https://github.com/mbabicz/SwiftGPT) 6 | [![iOS](https://img.shields.io/badge/iOS%20-14+-blue)](https://github.com/mbabicz/SwiftGPT) 7 | [![Swift](https://img.shields.io/static/v1?style=flat&message=Swift&color=F05138&logo=Swift&logoColor=FFFFFF&label=)](https://github.com/mbabicz/SwiftGPT) 8 | [![Swift](https://img.shields.io/static/v1?style=flat&message=SwiftUI&color=blue&logo=Swift&logoColor=FFFFFF&label=)](https://github.com/mbabicz/SwiftGPT) 9 | 10 | 11 | ## ABOUT THE PROJECT 12 | SwiftUI application that contains OpenAI GPT-3.5 Turbo or GPT 4 chat bot and OpenAI DALL·E 2 system. OpenAI client providing GPT-3.5 is implemented with [this library](https://github.com/alfianlosari/ChatGPTSwift). 13 | The DALL·E client is provided by [OpenAIKit](https://github.com/MarcoDotIO/OpenAIKit). To use OpenAI you will need to obtain your API from the [OpenAI website](https://openai.com/api/).

14 | ||| 15 | |:-:|:-:| 16 | 17 | ## INSTALLATION 18 | * Enter your [api key](https://openai.com/api/) in API.swift file 19 | here: 20 | ```swift 21 | static let apiKey = "API_KEY" 22 | ``` 23 | ## OPENAI CHATBOT 24 | ||| 25 | |:-:|:-:| 26 | 27 | ## OPENAI DALL·E 2
28 | ||| 29 | |:-:|:-:| 30 | 31 | ## BUILT WITH 32 |
33 | ![Swift](https://img.shields.io/badge/swift-F54A2A?style=for-the-badge&logo=swift&logoColor=white)
34 | 35 | -------------------------------------------------------------------------------- /SwiftGPT/ViewModels/GPTViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GPTViewModel.swift 3 | // SwiftGPT 4 | // 5 | // Created by mbabicz on 05/03/2023. 6 | // 7 | 8 | import Foundation 9 | import ChatGPTSwift 10 | 11 | final class GPTViewModel: ObservableObject { 12 | 13 | private let api: ChatGPTAPI 14 | @Published var messages: [Message] = [] 15 | @Published var typingMessage: String = "" 16 | @Published var isLoading: Bool = false 17 | let bottomID = UUID() 18 | 19 | init(api: ChatGPTAPI = ChatGPTAPI(apiKey: Secrets.openaiApiKey)) { 20 | self.api = api 21 | } 22 | 23 | func sendMessage() { 24 | guard !typingMessage.isEmpty else { return } 25 | let tempMessage = typingMessage 26 | typingMessage = "" 27 | Task { 28 | await getResponse(text: tempMessage) 29 | } 30 | } 31 | 32 | @MainActor 33 | private func addMessage(_ content: MessageContent, isUserMessage: Bool) { 34 | /// if messages list is empty just add new message 35 | guard let lastMessage = self.messages.last else { 36 | let message = Message(content: content, isUserMessage: isUserMessage) 37 | self.messages.append(message) 38 | return 39 | } 40 | let message = Message(content: content, isUserMessage: isUserMessage) 41 | 42 | /// if last message is an indicator switch with new one 43 | if case .indicator = lastMessage.content, !lastMessage.isUserMessage { 44 | self.messages[self.messages.count - 1] = message 45 | } else { 46 | /// otherwise, add new message to the end of the list 47 | self.messages.append(message) 48 | } 49 | 50 | if self.messages.count > Config.Messages.maxMessages { 51 | self.messages.removeFirst() 52 | } 53 | } 54 | 55 | func getResponse(text: String) async { 56 | await MainActor.run { isLoading = true } 57 | await addMessage(.text(text), isUserMessage: true) 58 | await addMessage(.indicator, isUserMessage: false) 59 | 60 | do { 61 | let stream = try await api.sendMessageStream(text: text) 62 | for try await line in stream { 63 | await MainActor.run { 64 | guard let lastIndex = self.messages.indices.last, 65 | case .text(let currentText) = self.messages[lastIndex].content else { return } 66 | self.messages[lastIndex].content = .text(currentText + line) 67 | } 68 | } 69 | } catch { 70 | await addMessage(.error(error.localizedDescription), isUserMessage: false) 71 | } 72 | 73 | await MainActor.run { isLoading = false } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /SwiftGPT/ViewModels/DalleViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DalleViewModel.swift 3 | // SwiftGPT 4 | // 5 | // Created by mbabicz on 06/02/2023. 6 | // 7 | 8 | import Foundation 9 | import OpenAIKit 10 | 11 | final class DalleViewModel: ObservableObject { 12 | 13 | private var openAI: OpenAI 14 | @Published var messages = [Message]() 15 | @Published var typingMessage: String = "" 16 | @Published var isLoading: Bool = false 17 | let bottomID = UUID() 18 | 19 | init(openAI: OpenAI = OpenAI(Configuration(organizationId: Config.API.organizationId, apiKey: Secrets.openaiApiKey))) { 20 | self.openAI = openAI 21 | } 22 | 23 | func sendMessage() { 24 | guard !typingMessage.isEmpty else { return } 25 | Task { 26 | let tempMessage = typingMessage.trimmingCharacters(in: .whitespaces) 27 | if !tempMessage.isEmpty { 28 | typingMessage = "" 29 | await generateImage(prompt: tempMessage) 30 | } 31 | } 32 | } 33 | 34 | func generateImage(prompt: String) async { 35 | await MainActor.run { isLoading = true } 36 | await addMessage(.text(prompt), isUserMessage: true) 37 | await addMessage(.indicator, isUserMessage: false) 38 | 39 | let imageParam = ImageParameters(prompt: prompt, resolution: .medium, responseFormat: .base64Json) 40 | 41 | do { 42 | let result = try await openAI.createImage(parameters: imageParam) 43 | let b64Image = result.data[0].image 44 | let output = try openAI.decodeBase64Image(b64Image) 45 | if let imageData = output.pngData() { 46 | await addMessage(.image(imageData), isUserMessage: false) 47 | } else { 48 | await addMessage(.error(L10n.Dalle.Error.imageConversion), isUserMessage: false) 49 | } 50 | } catch { 51 | debugPrint(error) 52 | await addMessage(.error(error.localizedDescription), isUserMessage: false) 53 | } 54 | 55 | await MainActor.run { isLoading = false } 56 | } 57 | 58 | @MainActor 59 | private func addMessage(_ content: MessageContent, isUserMessage: Bool) { 60 | // if messages list is empty just add new message 61 | guard let lastMessage = self.messages.last else { 62 | let message = Message(content: content, isUserMessage: isUserMessage) 63 | self.messages.append(message) 64 | return 65 | } 66 | let message = Message(content: content, isUserMessage: isUserMessage) 67 | 68 | // if last message is an indicator switch with new one 69 | if case .indicator = lastMessage.content, !lastMessage.isUserMessage { 70 | self.messages[self.messages.count - 1] = message 71 | } else { 72 | // otherwise, add new message to the end of the list 73 | self.messages.append(message) 74 | } 75 | 76 | if self.messages.count > Config.Messages.maxMessages { 77 | self.messages.removeFirst() 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | excluded: 2 | - "bin/*" 3 | - "Script/*" 4 | - "Generated/*" 5 | - "Package.swift" 6 | - "Resources/Localizables/Strings+Generated.swift" 7 | 8 | disabled_rules: 9 | - identifier_name 10 | - inclusive_language 11 | - type_name 12 | - redundant_string_enum_value 13 | - todo 14 | 15 | analyzer_rules: 16 | - explicit_self 17 | - unused_declaration 18 | - unused_import 19 | 20 | opt_in_rules: 21 | - array_init 22 | - closure_spacing 23 | - contains_over_filter_count 24 | - contains_over_filter_is_empty 25 | - contains_over_first_not_nil 26 | - contains_over_range_nil_comparison 27 | - cyclomatic_complexity 28 | - discouraged_object_literal 29 | - empty_collection_literal 30 | - empty_count 31 | - empty_string 32 | - expiring_todo 33 | - explicit_init 34 | - fatal_error_message 35 | - file_name_no_space 36 | - first_where 37 | - flatmap_over_map_reduce 38 | - identical_operands 39 | - joined_default_parameter 40 | - last_where 41 | - legacy_multiple 42 | - legacy_random 43 | - literal_expression_end_indentation 44 | - modifier_order 45 | - nimble_operator 46 | - operator_usage_whitespace 47 | - optional_enum_case_matching 48 | - overridden_super_call 49 | - prefer_self_type_over_type_of_self 50 | - prohibited_super_call 51 | - raw_value_for_camel_cased_codable_enum 52 | - redundant_nil_coalescing 53 | - required_enum_case 54 | - sorted_first_last 55 | - static_operator 56 | - toggle_bool 57 | - unneeded_parentheses_in_closure_argument 58 | - untyped_error_in_catch 59 | - vertical_whitespace_closing_braces 60 | - yoda_condition 61 | - comment_spacing 62 | - function_body_length 63 | - file_length 64 | - line_length 65 | - type_body_length 66 | - nesting 67 | - large_tuple 68 | - vertical_whitespace 69 | - force_cast 70 | - force_try 71 | - force_unwrapping 72 | - implicitly_unwrapped_optional 73 | - trailing_whitespace 74 | 75 | line_length: 76 | warning: 180 77 | error: 250 78 | ignores_comments: true 79 | 80 | function_body_length: 81 | warning: 120 82 | error: 180 83 | 84 | file_length: 85 | warning: 500 86 | error: 600 87 | 88 | type_body_length: 89 | warning: 500 90 | error: 600 91 | 92 | vertical_whitespace: 93 | max_empty_lines: 1 94 | 95 | nesting: 96 | type_level: 6 97 | 98 | large_tuple: 99 | warning: 5 100 | error: 6 101 | 102 | force_cast: 103 | severity: error 104 | 105 | force_try: 106 | severity: error 107 | 108 | force_unwrapping: 109 | severity: error 110 | 111 | implicitly_unwrapped_optional: 112 | severity: error 113 | 114 | custom_rules: 115 | private_state_finder: 116 | include: "*.swift" 117 | name: "Private State" 118 | regex: "(@State\\s+var)" 119 | message: "States should be private." 120 | severity: warning 121 | sf_safe_symbol: 122 | name: "Safe SFSymbol" 123 | message: "Use `SFSafeSymbols` via `systemSymbol` parameters for type safety." 124 | regex: "(Image\\(systemName:)|(NSImage\\(symbolName:)|(Label[^,]+?,\\s*systemImage:)|(UIApplicationShortcutIcon\\(systemImageName:)" 125 | severity: warning 126 | -------------------------------------------------------------------------------- /SwiftGPT/Views/Messages/MessageView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageView.swift 3 | // SwiftGPT 4 | // 5 | // Created by mbabicz on 02/02/2023. 6 | // 7 | 8 | import SwiftUI 9 | import PhotosUI 10 | 11 | struct MessageView: View { 12 | var message: Message 13 | @State private var showErrorAlert = false 14 | @State private var errorMessage = "" 15 | 16 | var body: some View { 17 | HStack(spacing: 0) { 18 | VStack(alignment: .leading, spacing: 0) { 19 | HStack(alignment: message.isUserMessage ? .center : .top) { 20 | Image(message.isUserMessage ? .personIcon : .gptLogo) 21 | .resizable() 22 | .frame(width: Config.UserInterface.avatarSize, height: Config.UserInterface.avatarSize) 23 | .padding(.trailing, .appSpacingSM) 24 | .accessibilityLabel(message.isUserMessage ? L10n.Accessibility.Image.user : L10n.Accessibility.Image.gpt) 25 | 26 | switch message.content { 27 | case let .text(output): 28 | Text(output) 29 | .foregroundStyle(.white) 30 | .textSelection(.enabled) 31 | case let .error(output): 32 | Text(output) 33 | .foregroundStyle(.red) 34 | .textSelection(.enabled) 35 | case let .image(imageData): 36 | if let uiImage = UIImage(data: imageData) { 37 | Image(uiImage: uiImage) 38 | .resizable() 39 | .aspectRatio(contentMode: .fit) 40 | .cornerRadius(Config.UserInterface.imageCornerRadius) 41 | .shadow(color: .green, radius: 1) 42 | .accessibilityLabel(L10n.Accessibility.Image.generated) 43 | .contextMenu { 44 | ShareLink(item: Image(uiImage: uiImage), preview: SharePreview("Generated Image")) 45 | .accessibilityLabel(L10n.Accessibility.Button.share) 46 | 47 | Button { 48 | Task { 49 | do { 50 | try await saveImageToLibrary(uiImage) 51 | } catch { 52 | await MainActor.run { 53 | errorMessage = error.localizedDescription 54 | showErrorAlert = true 55 | } 56 | } 57 | } 58 | } label: { 59 | Label("Save to Photos", systemSymbol: .squareAndArrowDown) 60 | } 61 | .accessibilityLabel(L10n.Accessibility.Button.save) 62 | } 63 | } 64 | case .indicator: 65 | MessageIndicatorView() 66 | } 67 | } 68 | .padding([.top, .bottom], .appSpacingMD) 69 | .padding(.leading, .appSpacingSM) 70 | } 71 | Spacer() 72 | } 73 | .background(message.isUserMessage ? Color(.userMessageBackground) : Color(.responseMessageBackground)) 74 | .shadow( radius: message.isUserMessage ? 0 : 0.5) 75 | .alert("Error", isPresented: $showErrorAlert) { 76 | Button("OK", role: .cancel) {} 77 | } message: { 78 | Text(errorMessage) 79 | } 80 | } 81 | 82 | func saveImageToLibrary(_ image: UIImage) async throws { 83 | try await PHPhotoLibrary.shared().performChanges { 84 | PHAssetChangeRequest.creationRequestForAsset(from: image) 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Resources/Localizables/Strings+Generated.swift: -------------------------------------------------------------------------------- 1 | // swiftlint:disable all 2 | // Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen 3 | 4 | import Foundation 5 | 6 | // swiftlint:disable superfluous_disable_command file_length implicit_return prefer_self_in_static_references 7 | 8 | // MARK: - Strings 9 | 10 | // swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length 11 | // swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces 12 | internal enum L10n { 13 | internal enum Accessibility { 14 | internal enum Button { 15 | /// Save image to photos 16 | internal static let save = L10n.tr("Localizable", "accessibility.button.save", fallback: "Save image to photos") 17 | /// Send message 18 | internal static let send = L10n.tr("Localizable", "accessibility.button.send", fallback: "Send message") 19 | /// Share image 20 | internal static let share = L10n.tr("Localizable", "accessibility.button.share", fallback: "Share image") 21 | internal enum Send { 22 | /// Sends your message to the AI 23 | internal static let hint = L10n.tr("Localizable", "accessibility.button.send.hint", fallback: "Sends your message to the AI") 24 | } 25 | } 26 | internal enum Image { 27 | /// Generated image 28 | internal static let generated = L10n.tr("Localizable", "accessibility.image.generated", fallback: "Generated image") 29 | /// AI avatar 30 | internal static let gpt = L10n.tr("Localizable", "accessibility.image.gpt", fallback: "AI avatar") 31 | /// User avatar 32 | internal static let user = L10n.tr("Localizable", "accessibility.image.user", fallback: "User avatar") 33 | } 34 | internal enum Tab { 35 | /// Chat with GPT 36 | internal static let chatgpt = L10n.tr("Localizable", "accessibility.tab.chatgpt", fallback: "Chat with GPT") 37 | /// Generate images with DALL·E 38 | internal static let dalle = L10n.tr("Localizable", "accessibility.tab.dalle", fallback: "Generate images with DALL·E") 39 | } 40 | internal enum Textfield { 41 | /// Message input field 42 | internal static let message = L10n.tr("Localizable", "accessibility.textfield.message", fallback: "Message input field") 43 | } 44 | } 45 | internal enum Chat { 46 | internal enum Introduce { 47 | /// Write your first message! 48 | internal static let title = L10n.tr("Localizable", "chat.introduce.title", fallback: "Write your first message!") 49 | } 50 | } 51 | internal enum Chatgpt { 52 | internal enum Tab { 53 | /// CHAT BOT 54 | internal static let title = L10n.tr("Localizable", "chatgpt.tab.title", fallback: "CHAT BOT") 55 | } 56 | } 57 | internal enum Dalle { 58 | internal enum Error { 59 | /// Image conversion error 60 | internal static let imageConversion = L10n.tr("Localizable", "dalle.error.image_conversion", fallback: "Image conversion error") 61 | } 62 | internal enum Tab { 63 | /// DALL·E 2 64 | internal static let title = L10n.tr("Localizable", "dalle.tab.title", fallback: "DALL·E 2") 65 | } 66 | } 67 | internal enum Error { 68 | /// API request failed 69 | internal static let api = L10n.tr("Localizable", "error.api", fallback: "API request failed") 70 | /// Network error occurred 71 | internal static let network = L10n.tr("Localizable", "error.network", fallback: "Network error occurred") 72 | /// Failed to save image to Photos 73 | internal static let savePhoto = L10n.tr("Localizable", "error.save_photo", fallback: "Failed to save image to Photos") 74 | /// Permission denied. Please allow access to Photos in Settings. 75 | internal static let savePhotoPermission = L10n.tr("Localizable", "error.save_photo_permission", fallback: "Permission denied. Please allow access to Photos in Settings.") 76 | /// An unexpected error occurred 77 | internal static let unknown = L10n.tr("Localizable", "error.unknown", fallback: "An unexpected error occurred") 78 | } 79 | internal enum Message { 80 | internal enum Textfield { 81 | /// Message... 82 | internal static let placeholder = L10n.tr("Localizable", "message.textfield.placeholder", fallback: "Message...") 83 | } 84 | } 85 | } 86 | // swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length 87 | // swiftlint:enable nesting type_body_length type_name vertical_whitespace_opening_braces 88 | 89 | // MARK: - Implementation Details 90 | 91 | extension L10n { 92 | private static func tr(_ table: String, _ key: String, _ args: CVarArg..., fallback value: String) -> String { 93 | let format = BundleToken.bundle.localizedString(forKey: key, value: value, table: table) 94 | return String(format: format, locale: Locale.current, arguments: args) 95 | } 96 | } 97 | 98 | // swiftlint:disable convenience_type 99 | private final class BundleToken { 100 | static let bundle: Bundle = { 101 | #if SWIFT_PACKAGE 102 | return Bundle.module 103 | #else 104 | return Bundle(for: BundleToken.self) 105 | #endif 106 | }() 107 | } 108 | // swiftlint:enable convenience_type 109 | -------------------------------------------------------------------------------- /SwiftGPT.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "originHash" : "5ad93eb81a254a241593b31b01bac2c4853f3487dd95f71d56484b3a0def8bb9", 3 | "pins" : [ 4 | { 5 | "identity" : "async-http-client", 6 | "kind" : "remoteSourceControl", 7 | "location" : "https://github.com/swift-server/async-http-client.git", 8 | "state" : { 9 | "revision" : "291438696abdd48d2a83b52465c176efbd94512b", 10 | "version" : "1.20.1" 11 | } 12 | }, 13 | { 14 | "identity" : "chatgptswift", 15 | "kind" : "remoteSourceControl", 16 | "location" : "https://github.com/alfianlosari/ChatGPTSwift", 17 | "state" : { 18 | "revision" : "3add305675795c1eeec93d6175a9b04d6f415c15", 19 | "version" : "1.4.0" 20 | } 21 | }, 22 | { 23 | "identity" : "collectionconcurrencykit", 24 | "kind" : "remoteSourceControl", 25 | "location" : "https://github.com/JohnSundell/CollectionConcurrencyKit.git", 26 | "state" : { 27 | "revision" : "b4f23e24b5a1bff301efc5e70871083ca029ff95", 28 | "version" : "0.2.0" 29 | } 30 | }, 31 | { 32 | "identity" : "cryptoswift", 33 | "kind" : "remoteSourceControl", 34 | "location" : "https://github.com/krzyzanowskim/CryptoSwift.git", 35 | "state" : { 36 | "revision" : "729e01bc9b9dab466ac85f21fb9ee2bc1c61b258", 37 | "version" : "1.8.4" 38 | } 39 | }, 40 | { 41 | "identity" : "gptencoder", 42 | "kind" : "remoteSourceControl", 43 | "location" : "https://github.com/alfianlosari/GPTEncoder.git", 44 | "state" : { 45 | "revision" : "a86968867ab4380e36b904a14c42215f71efe8b4", 46 | "version" : "1.0.4" 47 | } 48 | }, 49 | { 50 | "identity" : "openai", 51 | "kind" : "remoteSourceControl", 52 | "location" : "https://github.com/colealanroberts/openai", 53 | "state" : { 54 | "revision" : "8a428e6644301ca98d2dbb38a11c6b85a545e61c", 55 | "version" : "1.0.5" 56 | } 57 | }, 58 | { 59 | "identity" : "openaikit", 60 | "kind" : "remoteSourceControl", 61 | "location" : "https://github.com/MarcoDotIO/OpenAIKit", 62 | "state" : { 63 | "branch" : "main", 64 | "revision" : "9b93156e81491ac53967348e8a5076d323f37e34" 65 | } 66 | }, 67 | { 68 | "identity" : "sfsafesymbols", 69 | "kind" : "remoteSourceControl", 70 | "location" : "https://github.com/SFSafeSymbols/SFSafeSymbols", 71 | "state" : { 72 | "revision" : "3dd282d3269b061853a3b3bcd23a509d2aa166ce", 73 | "version" : "6.2.0" 74 | } 75 | }, 76 | { 77 | "identity" : "sourcekitten", 78 | "kind" : "remoteSourceControl", 79 | "location" : "https://github.com/jpsim/SourceKitten.git", 80 | "state" : { 81 | "revision" : "fd4df99170f5e9d7cf9aa8312aa8506e0e7a44e7", 82 | "version" : "0.35.0" 83 | } 84 | }, 85 | { 86 | "identity" : "swift-algorithms", 87 | "kind" : "remoteSourceControl", 88 | "location" : "https://github.com/apple/swift-algorithms", 89 | "state" : { 90 | "revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42", 91 | "version" : "1.2.0" 92 | } 93 | }, 94 | { 95 | "identity" : "swift-argument-parser", 96 | "kind" : "remoteSourceControl", 97 | "location" : "https://github.com/apple/swift-argument-parser.git", 98 | "state" : { 99 | "revision" : "41982a3656a71c768319979febd796c6fd111d5c", 100 | "version" : "1.5.0" 101 | } 102 | }, 103 | { 104 | "identity" : "swift-atomics", 105 | "kind" : "remoteSourceControl", 106 | "location" : "https://github.com/apple/swift-atomics.git", 107 | "state" : { 108 | "revision" : "cd142fd2f64be2100422d658e7411e39489da985", 109 | "version" : "1.2.0" 110 | } 111 | }, 112 | { 113 | "identity" : "swift-collections", 114 | "kind" : "remoteSourceControl", 115 | "location" : "https://github.com/apple/swift-collections.git", 116 | "state" : { 117 | "revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb", 118 | "version" : "1.1.0" 119 | } 120 | }, 121 | { 122 | "identity" : "swift-http-types", 123 | "kind" : "remoteSourceControl", 124 | "location" : "https://github.com/apple/swift-http-types", 125 | "state" : { 126 | "revision" : "12358d55a3824bd5fed310b999ea8cf83a9a1a65", 127 | "version" : "1.0.3" 128 | } 129 | }, 130 | { 131 | "identity" : "swift-log", 132 | "kind" : "remoteSourceControl", 133 | "location" : "https://github.com/apple/swift-log.git", 134 | "state" : { 135 | "revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5", 136 | "version" : "1.5.4" 137 | } 138 | }, 139 | { 140 | "identity" : "swift-nio", 141 | "kind" : "remoteSourceControl", 142 | "location" : "https://github.com/apple/swift-nio.git", 143 | "state" : { 144 | "revision" : "fc63f0cf4e55a4597407a9fc95b16a2bc44b4982", 145 | "version" : "2.64.0" 146 | } 147 | }, 148 | { 149 | "identity" : "swift-nio-extras", 150 | "kind" : "remoteSourceControl", 151 | "location" : "https://github.com/apple/swift-nio-extras.git", 152 | "state" : { 153 | "revision" : "a3b640d7dc567225db7c94386a6e71aded1bfa63", 154 | "version" : "1.22.0" 155 | } 156 | }, 157 | { 158 | "identity" : "swift-nio-http2", 159 | "kind" : "remoteSourceControl", 160 | "location" : "https://github.com/apple/swift-nio-http2.git", 161 | "state" : { 162 | "revision" : "0904bf0feb5122b7e5c3f15db7df0eabe623dd87", 163 | "version" : "1.30.0" 164 | } 165 | }, 166 | { 167 | "identity" : "swift-nio-ssl", 168 | "kind" : "remoteSourceControl", 169 | "location" : "https://github.com/apple/swift-nio-ssl.git", 170 | "state" : { 171 | "revision" : "7c381eb6083542b124a6c18fae742f55001dc2b5", 172 | "version" : "2.26.0" 173 | } 174 | }, 175 | { 176 | "identity" : "swift-nio-transport-services", 177 | "kind" : "remoteSourceControl", 178 | "location" : "https://github.com/apple/swift-nio-transport-services.git", 179 | "state" : { 180 | "revision" : "6cbe0ed2b394f21ab0d46b9f0c50c6be964968ce", 181 | "version" : "1.20.1" 182 | } 183 | }, 184 | { 185 | "identity" : "swift-numerics", 186 | "kind" : "remoteSourceControl", 187 | "location" : "https://github.com/apple/swift-numerics.git", 188 | "state" : { 189 | "revision" : "0a5bc04095a675662cf24757cc0640aa2204253b", 190 | "version" : "1.0.2" 191 | } 192 | }, 193 | { 194 | "identity" : "swift-syntax", 195 | "kind" : "remoteSourceControl", 196 | "location" : "https://github.com/swiftlang/swift-syntax.git", 197 | "state" : { 198 | "revision" : "cb53fa1bd3219b0b23ded7dfdd3b2baff266fd25", 199 | "version" : "600.0.0" 200 | } 201 | }, 202 | { 203 | "identity" : "swift-system", 204 | "kind" : "remoteSourceControl", 205 | "location" : "https://github.com/apple/swift-system.git", 206 | "state" : { 207 | "revision" : "025bcb1165deab2e20d4eaba79967ce73013f496", 208 | "version" : "1.2.1" 209 | } 210 | }, 211 | { 212 | "identity" : "swiftlint", 213 | "kind" : "remoteSourceControl", 214 | "location" : "https://github.com/realm/SwiftLint", 215 | "state" : { 216 | "revision" : "eba420f77846e93beb98d516b225abeb2fef4ca2", 217 | "version" : "0.58.2" 218 | } 219 | }, 220 | { 221 | "identity" : "swiftytexttable", 222 | "kind" : "remoteSourceControl", 223 | "location" : "https://github.com/scottrhoyt/SwiftyTextTable.git", 224 | "state" : { 225 | "revision" : "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3", 226 | "version" : "0.9.0" 227 | } 228 | }, 229 | { 230 | "identity" : "swxmlhash", 231 | "kind" : "remoteSourceControl", 232 | "location" : "https://github.com/drmohundro/SWXMLHash.git", 233 | "state" : { 234 | "revision" : "a853604c9e9a83ad9954c7e3d2a565273982471f", 235 | "version" : "7.0.2" 236 | } 237 | }, 238 | { 239 | "identity" : "yams", 240 | "kind" : "remoteSourceControl", 241 | "location" : "https://github.com/jpsim/Yams.git", 242 | "state" : { 243 | "revision" : "b4b8042411dc7bbb696300a34a4bf3ba1b7ad19b", 244 | "version" : "5.3.1" 245 | } 246 | } 247 | ], 248 | "version" : 3 249 | } 250 | -------------------------------------------------------------------------------- /SwiftGPT.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 70; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2917754E29B606EC00EEC302 /* OpenAI in Frameworks */ = {isa = PBXBuildFile; productRef = 2917754D29B606EC00EEC302 /* OpenAI */; }; 11 | 2917755329B60B2100EEC302 /* ChatGPTSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 2917755229B60B2100EEC302 /* ChatGPTSwift */; }; 12 | 2981BF212992578800D40C7A /* OpenAIKit in Frameworks */ = {isa = PBXBuildFile; productRef = 2981BF202992578800D40C7A /* OpenAIKit */; }; 13 | 6E44C8002D93121500268862 /* SFSafeSymbols in Frameworks */ = {isa = PBXBuildFile; productRef = 6E44C7FF2D93121500268862 /* SFSafeSymbols */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXContainerItemProxy section */ 17 | 6E023C552E8BEB6D004E7990 /* PBXContainerItemProxy */ = { 18 | isa = PBXContainerItemProxy; 19 | containerPortal = 2981BF06299256BB00D40C7A /* Project object */; 20 | proxyType = 1; 21 | remoteGlobalIDString = 2981BF0D299256BB00D40C7A; 22 | remoteInfo = SwiftGPT; 23 | }; 24 | /* End PBXContainerItemProxy section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 2981BF0E299256BB00D40C7A /* SwiftGPT.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftGPT.app; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 6E023C512E8BEB6D004E7990 /* SwiftGPTTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftGPTTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFileSystemSynchronizedRootGroup section */ 32 | 6E023C522E8BEB6D004E7990 /* SwiftGPTTests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = SwiftGPTTests; sourceTree = ""; }; 33 | 6E4ADDC32E8BE87A00AD8FA5 /* SwiftGPTTests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = SwiftGPTTests; sourceTree = ""; }; 34 | 6E4ADDE12E8BE88300AD8FA5 /* SwiftGPT */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = SwiftGPT; sourceTree = ""; }; 35 | 6E4ADE002E8BE91A00AD8FA5 /* Resources */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Resources; sourceTree = ""; }; 36 | /* End PBXFileSystemSynchronizedRootGroup section */ 37 | 38 | /* Begin PBXFrameworksBuildPhase section */ 39 | 2981BF0B299256BB00D40C7A /* Frameworks */ = { 40 | isa = PBXFrameworksBuildPhase; 41 | buildActionMask = 2147483647; 42 | files = ( 43 | 2917754E29B606EC00EEC302 /* OpenAI in Frameworks */, 44 | 2917755329B60B2100EEC302 /* ChatGPTSwift in Frameworks */, 45 | 6E44C8002D93121500268862 /* SFSafeSymbols in Frameworks */, 46 | 2981BF212992578800D40C7A /* OpenAIKit in Frameworks */, 47 | ); 48 | runOnlyForDeploymentPostprocessing = 0; 49 | }; 50 | 6E023C4E2E8BEB6D004E7990 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXFrameworksBuildPhase section */ 58 | 59 | /* Begin PBXGroup section */ 60 | 2981BF05299256BB00D40C7A = { 61 | isa = PBXGroup; 62 | children = ( 63 | 6E4ADDC32E8BE87A00AD8FA5 /* SwiftGPTTests */, 64 | 6E4ADDE12E8BE88300AD8FA5 /* SwiftGPT */, 65 | 6E023C522E8BEB6D004E7990 /* SwiftGPTTests */, 66 | 2981BF0F299256BB00D40C7A /* Products */, 67 | 6E4ADE002E8BE91A00AD8FA5 /* Resources */, 68 | ); 69 | sourceTree = ""; 70 | }; 71 | 2981BF0F299256BB00D40C7A /* Products */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 2981BF0E299256BB00D40C7A /* SwiftGPT.app */, 75 | 6E023C512E8BEB6D004E7990 /* SwiftGPTTests.xctest */, 76 | ); 77 | name = Products; 78 | sourceTree = ""; 79 | }; 80 | /* End PBXGroup section */ 81 | 82 | /* Begin PBXNativeTarget section */ 83 | 2981BF0D299256BB00D40C7A /* SwiftGPT */ = { 84 | isa = PBXNativeTarget; 85 | buildConfigurationList = 2981BF1C299256BE00D40C7A /* Build configuration list for PBXNativeTarget "SwiftGPT" */; 86 | buildPhases = ( 87 | 2981BF0A299256BB00D40C7A /* Sources */, 88 | 6E44C7FD2D9310B900268862 /* SwiftLint */, 89 | 2981BF0B299256BB00D40C7A /* Frameworks */, 90 | 2981BF0C299256BB00D40C7A /* Resources */, 91 | ); 92 | buildRules = ( 93 | ); 94 | dependencies = ( 95 | ); 96 | fileSystemSynchronizedGroups = ( 97 | 6E4ADDE12E8BE88300AD8FA5 /* SwiftGPT */, 98 | 6E4ADE002E8BE91A00AD8FA5 /* Resources */, 99 | ); 100 | name = SwiftGPT; 101 | packageProductDependencies = ( 102 | 2981BF202992578800D40C7A /* OpenAIKit */, 103 | 2917754D29B606EC00EEC302 /* OpenAI */, 104 | 2917755229B60B2100EEC302 /* ChatGPTSwift */, 105 | 6E44C7FF2D93121500268862 /* SFSafeSymbols */, 106 | ); 107 | productName = "OpenAI chat-dalle"; 108 | productReference = 2981BF0E299256BB00D40C7A /* SwiftGPT.app */; 109 | productType = "com.apple.product-type.application"; 110 | }; 111 | 6E023C502E8BEB6D004E7990 /* SwiftGPTTests */ = { 112 | isa = PBXNativeTarget; 113 | buildConfigurationList = 6E023C572E8BEB6D004E7990 /* Build configuration list for PBXNativeTarget "SwiftGPTTests" */; 114 | buildPhases = ( 115 | 6E023C4D2E8BEB6D004E7990 /* Sources */, 116 | 6E023C4E2E8BEB6D004E7990 /* Frameworks */, 117 | 6E023C4F2E8BEB6D004E7990 /* Resources */, 118 | ); 119 | buildRules = ( 120 | ); 121 | dependencies = ( 122 | 6E023C562E8BEB6D004E7990 /* PBXTargetDependency */, 123 | ); 124 | fileSystemSynchronizedGroups = ( 125 | 6E023C522E8BEB6D004E7990 /* SwiftGPTTests */, 126 | 6E4ADDC32E8BE87A00AD8FA5 /* SwiftGPTTests */, 127 | ); 128 | name = SwiftGPTTests; 129 | packageProductDependencies = ( 130 | ); 131 | productName = SwiftGPTTests; 132 | productReference = 6E023C512E8BEB6D004E7990 /* SwiftGPTTests.xctest */; 133 | productType = "com.apple.product-type.bundle.unit-test"; 134 | }; 135 | /* End PBXNativeTarget section */ 136 | 137 | /* Begin PBXProject section */ 138 | 2981BF06299256BB00D40C7A /* Project object */ = { 139 | isa = PBXProject; 140 | attributes = { 141 | BuildIndependentTargetsInParallel = 1; 142 | LastSwiftUpdateCheck = 1640; 143 | LastUpgradeCheck = 1640; 144 | TargetAttributes = { 145 | 2981BF0D299256BB00D40C7A = { 146 | CreatedOnToolsVersion = 14.2; 147 | }; 148 | 6E023C502E8BEB6D004E7990 = { 149 | CreatedOnToolsVersion = 16.4; 150 | TestTargetID = 2981BF0D299256BB00D40C7A; 151 | }; 152 | }; 153 | }; 154 | buildConfigurationList = 2981BF09299256BB00D40C7A /* Build configuration list for PBXProject "SwiftGPT" */; 155 | compatibilityVersion = "Xcode 14.0"; 156 | developmentRegion = en; 157 | hasScannedForEncodings = 0; 158 | knownRegions = ( 159 | en, 160 | Base, 161 | ); 162 | mainGroup = 2981BF05299256BB00D40C7A; 163 | packageReferences = ( 164 | 2981BF1F2992578800D40C7A /* XCRemoteSwiftPackageReference "OpenAIKit" */, 165 | 2917754C29B606EC00EEC302 /* XCRemoteSwiftPackageReference "openai" */, 166 | 2917755129B60B2100EEC302 /* XCRemoteSwiftPackageReference "ChatGPTSwift" */, 167 | 6E4DAC9C2D930F87003FA11C /* XCRemoteSwiftPackageReference "SwiftLint" */, 168 | 6E44C7FE2D93121500268862 /* XCRemoteSwiftPackageReference "SFSafeSymbols" */, 169 | ); 170 | productRefGroup = 2981BF0F299256BB00D40C7A /* Products */; 171 | projectDirPath = ""; 172 | projectRoot = ""; 173 | targets = ( 174 | 2981BF0D299256BB00D40C7A /* SwiftGPT */, 175 | 6E023C502E8BEB6D004E7990 /* SwiftGPTTests */, 176 | ); 177 | }; 178 | /* End PBXProject section */ 179 | 180 | /* Begin PBXResourcesBuildPhase section */ 181 | 2981BF0C299256BB00D40C7A /* Resources */ = { 182 | isa = PBXResourcesBuildPhase; 183 | buildActionMask = 2147483647; 184 | files = ( 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | }; 188 | 6E023C4F2E8BEB6D004E7990 /* Resources */ = { 189 | isa = PBXResourcesBuildPhase; 190 | buildActionMask = 2147483647; 191 | files = ( 192 | ); 193 | runOnlyForDeploymentPostprocessing = 0; 194 | }; 195 | /* End PBXResourcesBuildPhase section */ 196 | 197 | /* Begin PBXShellScriptBuildPhase section */ 198 | 6E44C7FD2D9310B900268862 /* SwiftLint */ = { 199 | isa = PBXShellScriptBuildPhase; 200 | alwaysOutOfDate = 1; 201 | buildActionMask = 2147483647; 202 | files = ( 203 | ); 204 | inputFileListPaths = ( 205 | ); 206 | inputPaths = ( 207 | ); 208 | name = SwiftLint; 209 | outputFileListPaths = ( 210 | ); 211 | outputPaths = ( 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | shellPath = /bin/sh; 215 | shellScript = "if [[ \"$(uname -m)\" == arm64 ]]\nthen\n export PATH=\"/opt/homebrew/bin:$PATH\"\nfi\n\nif command -v swiftlint >/dev/null 2>&1\nthen\n swiftlint\nelse\n echo \"warning: `swiftlint` command not found - See https://github.com/realm/SwiftLint#installation for installation instructions.\"\nfi\n"; 216 | showEnvVarsInLog = 0; 217 | }; 218 | /* End PBXShellScriptBuildPhase section */ 219 | 220 | /* Begin PBXSourcesBuildPhase section */ 221 | 2981BF0A299256BB00D40C7A /* Sources */ = { 222 | isa = PBXSourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | 6E023C4D2E8BEB6D004E7990 /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | }; 235 | /* End PBXSourcesBuildPhase section */ 236 | 237 | /* Begin PBXTargetDependency section */ 238 | 6E023C562E8BEB6D004E7990 /* PBXTargetDependency */ = { 239 | isa = PBXTargetDependency; 240 | target = 2981BF0D299256BB00D40C7A /* SwiftGPT */; 241 | targetProxy = 6E023C555E8BEB6D004E7990 /* PBXContainerItemProxy */; 242 | }; 243 | /* End PBXTargetDependency section */ 244 | 245 | /* Begin XCBuildConfiguration section */ 246 | 2981BF1A299256BE00D40C7A /* Debug */ = { 247 | isa = XCBuildConfiguration; 248 | buildSettings = { 249 | ALWAYS_SEARCH_USER_PATHS = NO; 250 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 251 | CLANG_ANALYZER_NONNULL = YES; 252 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 253 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 254 | CLANG_ENABLE_MODULES = YES; 255 | CLANG_ENABLE_OBJC_ARC = YES; 256 | CLANG_ENABLE_OBJC_WEAK = YES; 257 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 258 | CLANG_WARN_BOOL_CONVERSION = YES; 259 | CLANG_WARN_COMMA = YES; 260 | CLANG_WARN_CONSTANT_CONVERSION = YES; 261 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 262 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 263 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 264 | CLANG_WARN_EMPTY_BODY = YES; 265 | CLANG_WARN_ENUM_CONVERSION = YES; 266 | CLANG_WARN_INFINITE_RECURSION = YES; 267 | CLANG_WARN_INT_CONVERSION = YES; 268 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 269 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 270 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 271 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 272 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 273 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 274 | CLANG_WARN_STRICT_PROTOTYPES = YES; 275 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 276 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 277 | CLANG_WARN_UNREACHABLE_CODE = YES; 278 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 279 | COPY_PHASE_STRIP = NO; 280 | DEBUG_INFORMATION_FORMAT = dwarf; 281 | DEVELOPMENT_TEAM = TU72F4GFFV; 282 | ENABLE_STRICT_OBJC_MSGSEND = YES; 283 | ENABLE_TESTABILITY = YES; 284 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 285 | GCC_C_LANGUAGE_STANDARD = gnu11; 286 | GCC_DYNAMIC_NO_PIC = NO; 287 | GCC_NO_COMMON_BLOCKS = YES; 288 | GCC_OPTIMIZATION_LEVEL = 0; 289 | GCC_PREPROCESSOR_DEFINITIONS = ( 290 | "DEBUG=1", 291 | "$(inherited)", 292 | ); 293 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 294 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 295 | GCC_WARN_UNDECLARED_SELECTOR = YES; 296 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 297 | GCC_WARN_UNUSED_FUNCTION = YES; 298 | GCC_WARN_UNUSED_VARIABLE = YES; 299 | IPHONEOS_DEPLOYMENT_TARGET = 16.2; 300 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 301 | MTL_FAST_MATH = YES; 302 | ONLY_ACTIVE_ARCH = YES; 303 | SDKROOT = iphoneos; 304 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 305 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 306 | SWIFT_VERSION = 5.0; 307 | }; 308 | name = Debug; 309 | }; 310 | 2981BF1B299256BE00D40C7A /* Release */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ALWAYS_SEARCH_USER_PATHS = NO; 314 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 315 | CLANG_ANALYZER_NONNULL = YES; 316 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 318 | CLANG_ENABLE_MODULES = YES; 319 | CLANG_ENABLE_OBJC_ARC = YES; 320 | CLANG_ENABLE_OBJC_WEAK = YES; 321 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 322 | CLANG_WARN_BOOL_CONVERSION = YES; 323 | CLANG_WARN_COMMA = YES; 324 | CLANG_WARN_CONSTANT_CONVERSION = YES; 325 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 326 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 327 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 328 | CLANG_WARN_EMPTY_BODY = YES; 329 | CLANG_WARN_ENUM_CONVERSION = YES; 330 | CLANG_WARN_INFINITE_RECURSION = YES; 331 | CLANG_WARN_INT_CONVERSION = YES; 332 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 333 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 334 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 335 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 336 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 337 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 338 | CLANG_WARN_STRICT_PROTOTYPES = YES; 339 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 340 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 341 | CLANG_WARN_UNREACHABLE_CODE = YES; 342 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 343 | COPY_PHASE_STRIP = NO; 344 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 345 | DEVELOPMENT_TEAM = TU72F4GFFV; 346 | ENABLE_NS_ASSERTIONS = NO; 347 | ENABLE_STRICT_OBJC_MSGSEND = YES; 348 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 349 | GCC_C_LANGUAGE_STANDARD = gnu11; 350 | GCC_NO_COMMON_BLOCKS = YES; 351 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 352 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 353 | GCC_WARN_UNDECLARED_SELECTOR = YES; 354 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 355 | GCC_WARN_UNUSED_FUNCTION = YES; 356 | GCC_WARN_UNUSED_VARIABLE = YES; 357 | IPHONEOS_DEPLOYMENT_TARGET = 16.2; 358 | MTL_ENABLE_DEBUG_INFO = NO; 359 | MTL_FAST_MATH = YES; 360 | SDKROOT = iphoneos; 361 | SWIFT_COMPILATION_MODE = wholemodule; 362 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 363 | SWIFT_VERSION = 5.0; 364 | VALIDATE_PRODUCT = YES; 365 | }; 366 | name = Release; 367 | }; 368 | 2981BF1D299256BE00D40C7A /* Debug */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 372 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 373 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 374 | CODE_SIGN_STYLE = Automatic; 375 | CURRENT_PROJECT_VERSION = 1; 376 | DEVELOPMENT_ASSET_PATHS = "\"SwiftGPT/Preview Content\""; 377 | ENABLE_PREVIEWS = YES; 378 | ENABLE_USER_SCRIPT_SANDBOXING = NO; 379 | GENERATE_INFOPLIST_FILE = YES; 380 | INFOPLIST_FILE = "SwiftGPT-Info.plist"; 381 | INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = .; 382 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 383 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 384 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 385 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 386 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 387 | INFOPLIST_KEY_UIUserInterfaceStyle = Dark; 388 | LD_RUNPATH_SEARCH_PATHS = ( 389 | "$(inherited)", 390 | "@executable_path/Frameworks", 391 | ); 392 | MARKETING_VERSION = 1.0; 393 | PRODUCT_BUNDLE_IDENTIFIER = mbabicz.SwiftGPT.; 394 | PRODUCT_NAME = "$(TARGET_NAME)"; 395 | SWIFT_EMIT_LOC_STRINGS = YES; 396 | SWIFT_VERSION = 5.0; 397 | TARGETED_DEVICE_FAMILY = "1,2"; 398 | }; 399 | name = Debug; 400 | }; 401 | 2981BF1E299256BE00D40C7A /* Release */ = { 402 | isa = XCBuildConfiguration; 403 | buildSettings = { 404 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 405 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 406 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 407 | CODE_SIGN_STYLE = Automatic; 408 | CURRENT_PROJECT_VERSION = 1; 409 | DEVELOPMENT_ASSET_PATHS = "\"SwiftGPT/Preview Content\""; 410 | ENABLE_PREVIEWS = YES; 411 | ENABLE_USER_SCRIPT_SANDBOXING = NO; 412 | GENERATE_INFOPLIST_FILE = YES; 413 | INFOPLIST_FILE = "SwiftGPT-Info.plist"; 414 | INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = .; 415 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 416 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 417 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 418 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 419 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 420 | INFOPLIST_KEY_UIUserInterfaceStyle = Dark; 421 | LD_RUNPATH_SEARCH_PATHS = ( 422 | "$(inherited)", 423 | "@executable_path/Frameworks", 424 | ); 425 | MARKETING_VERSION = 1.0; 426 | PRODUCT_BUNDLE_IDENTIFIER = mbabicz.SwiftGPT.; 427 | PRODUCT_NAME = "$(TARGET_NAME)"; 428 | SWIFT_EMIT_LOC_STRINGS = YES; 429 | SWIFT_VERSION = 5.0; 430 | TARGETED_DEVICE_FAMILY = "1,2"; 431 | }; 432 | name = Release; 433 | }; 434 | 6E023C582E8BEB6D004E7990 /* Debug */ = { 435 | isa = XCBuildConfiguration; 436 | buildSettings = { 437 | BUNDLE_LOADER = "$(TEST_HOST)"; 438 | CODE_SIGN_STYLE = Automatic; 439 | CURRENT_PROJECT_VERSION = 1; 440 | DEVELOPMENT_TEAM = TU72F4GFFV; 441 | GCC_C_LANGUAGE_STANDARD = gnu17; 442 | GENERATE_INFOPLIST_FILE = YES; 443 | IPHONEOS_DEPLOYMENT_TARGET = 18.5; 444 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES; 445 | MARKETING_VERSION = 1.0; 446 | PRODUCT_BUNDLE_IDENTIFIER = codecake.SwiftGPTTests; 447 | PRODUCT_NAME = "$(TARGET_NAME)"; 448 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; 449 | SWIFT_EMIT_LOC_STRINGS = NO; 450 | SWIFT_VERSION = 5.0; 451 | TARGETED_DEVICE_FAMILY = "1,2"; 452 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftGPT.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/SwiftGPT"; 453 | }; 454 | name = Debug; 455 | }; 456 | 6E023C592E8BEB6D004E7990 /* Release */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | BUNDLE_LOADER = "$(TEST_HOST)"; 460 | CODE_SIGN_STYLE = Automatic; 461 | CURRENT_PROJECT_VERSION = 1; 462 | DEVELOPMENT_TEAM = TU72F4GFFV; 463 | GCC_C_LANGUAGE_STANDARD = gnu17; 464 | GENERATE_INFOPLIST_FILE = YES; 465 | IPHONEOS_DEPLOYMENT_TARGET = 18.5; 466 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES; 467 | MARKETING_VERSION = 1.0; 468 | PRODUCT_BUNDLE_IDENTIFIER = codecake.SwiftGPTTests; 469 | PRODUCT_NAME = "$(TARGET_NAME)"; 470 | SWIFT_EMIT_LOC_STRINGS = NO; 471 | SWIFT_VERSION = 5.0; 472 | TARGETED_DEVICE_FAMILY = "1,2"; 473 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftGPT.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/SwiftGPT"; 474 | }; 475 | name = Release; 476 | }; 477 | /* End XCBuildConfiguration section */ 478 | 479 | /* Begin XCConfigurationList section */ 480 | 2981BF09299256BB00D40C7A /* Build configuration list for PBXProject "SwiftGPT" */ = { 481 | isa = XCConfigurationList; 482 | buildConfigurations = ( 483 | 2981BF1A299256BE00D40C7A /* Debug */, 484 | 2981BF1B299256BE00D40C7A /* Release */, 485 | ); 486 | defaultConfigurationIsVisible = 0; 487 | defaultConfigurationName = Release; 488 | }; 489 | 2981BF1C299256BE00D40C7A /* Build configuration list for PBXNativeTarget "SwiftGPT" */ = { 490 | isa = XCConfigurationList; 491 | buildConfigurations = ( 492 | 2981BF1D299256BE00D40C7A /* Debug */, 493 | 2981BF1E299256BE00D40C7A /* Release */, 494 | ); 495 | defaultConfigurationIsVisible = 0; 496 | defaultConfigurationName = Release; 497 | }; 498 | 6E023C572E8BEB6D004E7990 /* Build configuration list for PBXNativeTarget "SwiftGPTTests" */ = { 499 | isa = XCConfigurationList; 500 | buildConfigurations = ( 501 | 6E023C582E8BEB6D004E7990 /* Debug */, 502 | 6E023C592E8BEB6D004E7990 /* Release */, 503 | ); 504 | defaultConfigurationIsVisible = 0; 505 | defaultConfigurationName = Release; 506 | }; 507 | /* End XCConfigurationList section */ 508 | 509 | /* Begin XCRemoteSwiftPackageReference section */ 510 | 2917754C29B606EC00EEC302 /* XCRemoteSwiftPackageReference "openai" */ = { 511 | isa = XCRemoteSwiftPackageReference; 512 | repositoryURL = "https://github.com/colealanroberts/openai"; 513 | requirement = { 514 | kind = upToNextMajorVersion; 515 | minimumVersion = 1.0.0; 516 | }; 517 | }; 518 | 2917755129B60B2100EEC302 /* XCRemoteSwiftPackageReference "ChatGPTSwift" */ = { 519 | isa = XCRemoteSwiftPackageReference; 520 | repositoryURL = "https://github.com/alfianlosari/ChatGPTSwift"; 521 | requirement = { 522 | kind = upToNextMajorVersion; 523 | minimumVersion = 1.0.0; 524 | }; 525 | }; 526 | 2981BF1F2992578800D40C7A /* XCRemoteSwiftPackageReference "OpenAIKit" */ = { 527 | isa = XCRemoteSwiftPackageReference; 528 | repositoryURL = "https://github.com/MarcoDotIO/OpenAIKit"; 529 | requirement = { 530 | branch = main; 531 | kind = branch; 532 | }; 533 | }; 534 | 6E44C7FE2D93121500268862 /* XCRemoteSwiftPackageReference "SFSafeSymbols" */ = { 535 | isa = XCRemoteSwiftPackageReference; 536 | repositoryURL = "https://github.com/SFSafeSymbols/SFSafeSymbols"; 537 | requirement = { 538 | kind = upToNextMajorVersion; 539 | minimumVersion = 6.2.0; 540 | }; 541 | }; 542 | 6E4DAC9C2D930F87003FA11C /* XCRemoteSwiftPackageReference "SwiftLint" */ = { 543 | isa = XCRemoteSwiftPackageReference; 544 | repositoryURL = "https://github.com/realm/SwiftLint"; 545 | requirement = { 546 | kind = upToNextMajorVersion; 547 | minimumVersion = 0.58.2; 548 | }; 549 | }; 550 | /* End XCRemoteSwiftPackageReference section */ 551 | 552 | /* Begin XCSwiftPackageProductDependency section */ 553 | 2917754D29B606EC00EEC302 /* OpenAI */ = { 554 | isa = XCSwiftPackageProductDependency; 555 | package = 2917754C29B606EC00EEC302 /* XCRemoteSwiftPackageReference "openai" */; 556 | productName = OpenAI; 557 | }; 558 | 2917755229B60B2100EEC302 /* ChatGPTSwift */ = { 559 | isa = XCSwiftPackageProductDependency; 560 | package = 2917755129B60B2100EEC302 /* XCRemoteSwiftPackageReference "ChatGPTSwift" */; 561 | productName = ChatGPTSwift; 562 | }; 563 | 2981BF202992578800D40C7A /* OpenAIKit */ = { 564 | isa = XCSwiftPackageProductDependency; 565 | package = 2981BF1F2992578800D40C7A /* XCRemoteSwiftPackageReference "OpenAIKit" */; 566 | productName = OpenAIKit; 567 | }; 568 | 6E44C7FF2D93121500268862 /* SFSafeSymbols */ = { 569 | isa = XCSwiftPackageProductDependency; 570 | package = 6E44C7FE2D93121500268862 /* XCRemoteSwiftPackageReference "SFSafeSymbols" */; 571 | productName = SFSafeSymbols; 572 | }; 573 | /* End XCSwiftPackageProductDependency section */ 574 | }; 575 | rootObject = 2981BF06299256BB00D40C7A /* Project object */; 576 | } 577 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------