From 5bad233b9064804962f4b7a32df828934a636a7a Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 1 Sep 2021 14:28:47 +0100 Subject: [PATCH] Clean up and make an application target so that debug works in live preview. --- DesignKit/Source/Colors.swift | 2 -- DesignKit/Source/Fonts.swift | 1 - .../Avatar/Mock/MockAvatarService.swift | 2 +- .../Modules/Common/Theme/ThemePublisher.swift | 2 +- RiotSwiftUI/RiotSwiftUIApp.swift | 30 +++++++++++++++++++ RiotSwiftUI/target.yml | 4 ++- 6 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 RiotSwiftUI/RiotSwiftUIApp.swift diff --git a/DesignKit/Source/Colors.swift b/DesignKit/Source/Colors.swift index 1161d48f8..aaa5a936c 100644 --- a/DesignKit/Source/Colors.swift +++ b/DesignKit/Source/Colors.swift @@ -15,8 +15,6 @@ // import Foundation -import UIKit -import SwiftUI /// Colors at https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1255%3A1104 public protocol Colors { diff --git a/DesignKit/Source/Fonts.swift b/DesignKit/Source/Fonts.swift index 7f5d68b79..1203a2888 100644 --- a/DesignKit/Source/Fonts.swift +++ b/DesignKit/Source/Fonts.swift @@ -15,7 +15,6 @@ // import UIKit -import SwiftUI /// Describe fonts used in the application. /// Font names are based on Element typograhy https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1362%3A0 which is based on Apple font text styles (UIFont.TextStyle): https://developer.apple.com/documentation/uikit/uifonttextstyle diff --git a/RiotSwiftUI/Modules/Common/Avatar/Mock/MockAvatarService.swift b/RiotSwiftUI/Modules/Common/Avatar/Mock/MockAvatarService.swift index 92b31af71..0ee87d429 100644 --- a/RiotSwiftUI/Modules/Common/Avatar/Mock/MockAvatarService.swift +++ b/RiotSwiftUI/Modules/Common/Avatar/Mock/MockAvatarService.swift @@ -24,7 +24,7 @@ class MockAvatarService: AvatarServiceType { static let example: AvatarServiceType = MockAvatarService() func avatarImage(mxContentUri: String, avatarSize: AvatarSize) -> Future { Future { promise in - promise(.success(Asset.Images.appSymbol.image)) + promise(.success(Asset.Images.appSymbol.image)) } } } diff --git a/RiotSwiftUI/Modules/Common/Theme/ThemePublisher.swift b/RiotSwiftUI/Modules/Common/Theme/ThemePublisher.swift index c52f5337a..c721d7bf1 100644 --- a/RiotSwiftUI/Modules/Common/Theme/ThemePublisher.swift +++ b/RiotSwiftUI/Modules/Common/Theme/ThemePublisher.swift @@ -20,7 +20,7 @@ import Combine /** Provides the theme and theme updates to SwiftUI. Replaces the old ThemeObserver. Riot app can push updates to this class - removing the dependency of this calss on the `ThemeService`. + removing the dependency of this class on the `ThemeService`. */ @available(iOS 14.0, *) class ThemePublisher: ObservableObject { diff --git a/RiotSwiftUI/RiotSwiftUIApp.swift b/RiotSwiftUI/RiotSwiftUIApp.swift new file mode 100644 index 000000000..417ae1872 --- /dev/null +++ b/RiotSwiftUI/RiotSwiftUIApp.swift @@ -0,0 +1,30 @@ +// +// Copyright 2021 New Vector Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +import SwiftUI + +/** + Just needed so the application target has an entry point for the moment. + Could use to render the different screens. + */ +@available(iOS 14.0, *) +@main +struct testApp: App { + var body: some Scene { + WindowGroup { + Text("app") + } + } +} diff --git a/RiotSwiftUI/target.yml b/RiotSwiftUI/target.yml index e0bbf2ccb..f9ee0453e 100644 --- a/RiotSwiftUI/target.yml +++ b/RiotSwiftUI/target.yml @@ -21,7 +21,7 @@ schemes: targets: RiotSwiftUI: - type: framework + type: application platform: iOS dependencies: - target: DesignKit @@ -35,6 +35,8 @@ targets: buildPhase: resources - path: ../Riot/Assets/Images.xcassets buildPhase: resources + - path: ../Riot/Assets/SharedImages.xcassets + buildPhase: resources configFiles: Debug: Debug.xcconfig Release: Release.xcconfig