From 4fdf4e2c14b3edda48b7e309791378f739fc76ad Mon Sep 17 00:00:00 2001 From: Nikita Vilunov Date: Fri, 14 Jun 2024 00:58:15 +0200 Subject: [PATCH] Initial Commit --- Lavina.xcodeproj/project.pbxproj | 346 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../xcschemes/xcschememanagement.plist | 14 + .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 58 +++ Lavina/Assets.xcassets/Contents.json | 6 + Lavina/ContentView.swift | 171 +++++++++ Lavina/Lavina.entitlements | 10 + Lavina/LavinaApp.swift | 10 + .../Preview Assets.xcassets/Contents.json | 6 + 11 files changed, 647 insertions(+) create mode 100644 Lavina.xcodeproj/project.pbxproj create mode 100644 Lavina.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Lavina.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Lavina.xcodeproj/xcuserdata/nikita.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 Lavina/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 Lavina/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Lavina/Assets.xcassets/Contents.json create mode 100644 Lavina/ContentView.swift create mode 100644 Lavina/Lavina.entitlements create mode 100644 Lavina/LavinaApp.swift create mode 100644 Lavina/Preview Content/Preview Assets.xcassets/Contents.json diff --git a/Lavina.xcodeproj/project.pbxproj b/Lavina.xcodeproj/project.pbxproj new file mode 100644 index 0000000..7cc4b1a --- /dev/null +++ b/Lavina.xcodeproj/project.pbxproj @@ -0,0 +1,346 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + 11993EBD2C1BB1050042C150 /* LavinaApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11993EBC2C1BB1050042C150 /* LavinaApp.swift */; }; + 11993EBF2C1BB1050042C150 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11993EBE2C1BB1050042C150 /* ContentView.swift */; }; + 11993EC12C1BB1070042C150 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 11993EC02C1BB1070042C150 /* Assets.xcassets */; }; + 11993EC42C1BB1070042C150 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 11993EC32C1BB1070042C150 /* Preview Assets.xcassets */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 11993EB92C1BB1050042C150 /* Lavina.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Lavina.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 11993EBC2C1BB1050042C150 /* LavinaApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LavinaApp.swift; sourceTree = ""; }; + 11993EBE2C1BB1050042C150 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 11993EC02C1BB1070042C150 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 11993EC32C1BB1070042C150 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 11993EC52C1BB1070042C150 /* Lavina.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Lavina.entitlements; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 11993EB62C1BB1050042C150 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 11993EB02C1BB1050042C150 = { + isa = PBXGroup; + children = ( + 11993EBB2C1BB1050042C150 /* Lavina */, + 11993EBA2C1BB1050042C150 /* Products */, + ); + sourceTree = ""; + }; + 11993EBA2C1BB1050042C150 /* Products */ = { + isa = PBXGroup; + children = ( + 11993EB92C1BB1050042C150 /* Lavina.app */, + ); + name = Products; + sourceTree = ""; + }; + 11993EBB2C1BB1050042C150 /* Lavina */ = { + isa = PBXGroup; + children = ( + 11993EBC2C1BB1050042C150 /* LavinaApp.swift */, + 11993EBE2C1BB1050042C150 /* ContentView.swift */, + 11993EC02C1BB1070042C150 /* Assets.xcassets */, + 11993EC52C1BB1070042C150 /* Lavina.entitlements */, + 11993EC22C1BB1070042C150 /* Preview Content */, + ); + path = Lavina; + sourceTree = ""; + }; + 11993EC22C1BB1070042C150 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 11993EC32C1BB1070042C150 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 11993EB82C1BB1050042C150 /* Lavina */ = { + isa = PBXNativeTarget; + buildConfigurationList = 11993EC82C1BB1070042C150 /* Build configuration list for PBXNativeTarget "Lavina" */; + buildPhases = ( + 11993EB52C1BB1050042C150 /* Sources */, + 11993EB62C1BB1050042C150 /* Frameworks */, + 11993EB72C1BB1050042C150 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Lavina; + productName = Lavina; + productReference = 11993EB92C1BB1050042C150 /* Lavina.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 11993EB12C1BB1050042C150 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1540; + LastUpgradeCheck = 1540; + TargetAttributes = { + 11993EB82C1BB1050042C150 = { + CreatedOnToolsVersion = 15.4; + }; + }; + }; + buildConfigurationList = 11993EB42C1BB1050042C150 /* Build configuration list for PBXProject "Lavina" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 11993EB02C1BB1050042C150; + productRefGroup = 11993EBA2C1BB1050042C150 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 11993EB82C1BB1050042C150 /* Lavina */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 11993EB72C1BB1050042C150 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 11993EC42C1BB1070042C150 /* Preview Assets.xcassets in Resources */, + 11993EC12C1BB1070042C150 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 11993EB52C1BB1050042C150 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 11993EBF2C1BB1050042C150 /* ContentView.swift in Sources */, + 11993EBD2C1BB1050042C150 /* LavinaApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 11993EC62C1BB1070042C150 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 14.5; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 11993EC72C1BB1070042C150 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 14.5; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + }; + name = Release; + }; + 11993EC92C1BB1070042C150 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = Lavina/Lavina.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"Lavina/Preview Content\""; + DEVELOPMENT_TEAM = 4G6BW6A6BT; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = me.vilunov.Lavina; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 11993ECA2C1BB1070042C150 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = Lavina/Lavina.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"Lavina/Preview Content\""; + DEVELOPMENT_TEAM = 4G6BW6A6BT; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = me.vilunov.Lavina; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 11993EB42C1BB1050042C150 /* Build configuration list for PBXProject "Lavina" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 11993EC62C1BB1070042C150 /* Debug */, + 11993EC72C1BB1070042C150 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 11993EC82C1BB1070042C150 /* Build configuration list for PBXNativeTarget "Lavina" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 11993EC92C1BB1070042C150 /* Debug */, + 11993ECA2C1BB1070042C150 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 11993EB12C1BB1050042C150 /* Project object */; +} diff --git a/Lavina.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Lavina.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Lavina.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Lavina.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Lavina.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Lavina.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Lavina.xcodeproj/xcuserdata/nikita.xcuserdatad/xcschemes/xcschememanagement.plist b/Lavina.xcodeproj/xcuserdata/nikita.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..b4665e9 --- /dev/null +++ b/Lavina.xcodeproj/xcuserdata/nikita.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Lavina.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Lavina/Assets.xcassets/AccentColor.colorset/Contents.json b/Lavina/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Lavina/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Lavina/Assets.xcassets/AppIcon.appiconset/Contents.json b/Lavina/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..3f00db4 --- /dev/null +++ b/Lavina/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Lavina/Assets.xcassets/Contents.json b/Lavina/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Lavina/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Lavina/ContentView.swift b/Lavina/ContentView.swift new file mode 100644 index 0000000..f44d06e --- /dev/null +++ b/Lavina/ContentView.swift @@ -0,0 +1,171 @@ +import SwiftUI + +enum Selector: Hashable { + case overview + case room(String) + case direct(String) +} + +struct Room: Identifiable { + var id: String { name } + let name: String +} + +struct Direct: Identifiable { + var id: String { name } + let name: String +} + +struct ContentView: View { + let rooms = ["Core Dev", "Rust", "Ads"].map { Room(name: $0) } + let directs = ["Jeroen", "Ilnur"].map { Direct(name: $0) } + @State private var selected: Selector = .overview; + + var body: some View { + NavigationSplitView { + List(selection: $selected) { + Text("Overview").tag(Selector.overview) + Section("Rooms") { + ForEach(rooms) { it in + Text(it.name).tag(Selector.room(it.id)) + } + } + Section("Directs") { + ForEach(directs) { it in + Text(it.name).tag(Selector.direct(it.id)) + } + } + } + } detail: { + switch selected { + case .overview: + Overview() + case .room(_): + TopicListView() + case .direct(_): + MessageListView() + } + } + } +} + +struct Overview: View { + var body: some View { + Text("welcome") + } +} + +struct MessageListView: View { + @State var newMessage: String = "" + @ObservedObject var viewModel: TopicViewModel = TopicViewModel(messages: [ + Message(author: "Jeroen", body: "Hello everyone!"), + Message(author: "Jeroen", body: "Hoe gaat het?"), + Message(author: "Ilnur", body: "Normalno"), + Message(author: "Jeroen", body: "Zbs!"), + ]) + + var body: some View { + ScrollView { + Text("Start of the conversation") + VStack(alignment: .leading) { + ForEach(viewModel.messages) { it in + Divider() + MessageBatchView( + author: it.author, + messages: [it.body] + ) + } + } + } + .contentMargins(5) + .defaultScrollAnchor(.bottom) + .background(.white) + HStack { + TextField(text: $newMessage) { + Text("New message") + }.textFieldStyle(.roundedBorder) + Button(action: {}) { + Text("Send") + } + }.padding(5) + } +} + +struct MessageBatchView: View { + let author: String + let messages: [String] + + var body: some View { + Text("\(author):").bold() + ForEach(messages, id: \.hash) { it in + Text(it) + } + } +} + +struct TopicListView: View { + @State var topicTitle: String = "" + + var body: some View { + ScrollView { + VStack(alignment: .leading) { + TextField(text: $topicTitle) { + Text("A new topic!") + } + Divider() + TopicSlugView( + title: "How do I patch KDE3 for FreeBSD?", + numberOfReplies: 5, + openedWhen: "Opened 5 days ago" + ) + TopicSlugView( + title: "Our coffee machine is broken, pls fix", + numberOfReplies: 133, + openedWhen: "Opened yesterday" + ) + } + .padding(5) + } + } +} + +struct TopicSlugView: View { + let title: String + let numberOfReplies: Int + let openedWhen: String + + var body: some View { + Button { + + } label: { + VStack(alignment: .leading) { + Text(title).bold() + HStack { + Text("\(numberOfReplies) replies") + Spacer() + Text(openedWhen) + + } + } + } + } +} + +class TopicViewModel: ObservableObject { + @Published var messages: [Message] + + init(messages: [Message]) { + self.messages = messages + } + +} + +struct Message: Identifiable { + let id: UUID = UUID() + var author: String + var body: String +} + +#Preview { + ContentView() +} diff --git a/Lavina/Lavina.entitlements b/Lavina/Lavina.entitlements new file mode 100644 index 0000000..18aff0c --- /dev/null +++ b/Lavina/Lavina.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Lavina/LavinaApp.swift b/Lavina/LavinaApp.swift new file mode 100644 index 0000000..be7abed --- /dev/null +++ b/Lavina/LavinaApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct LavinaApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/Lavina/Preview Content/Preview Assets.xcassets/Contents.json b/Lavina/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Lavina/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +}