diff --git a/SwiftLeeds.xcodeproj/project.pbxproj b/SwiftLeeds.xcodeproj/project.pbxproj index a012eeb..d79e636 100644 --- a/SwiftLeeds.xcodeproj/project.pbxproj +++ b/SwiftLeeds.xcodeproj/project.pbxproj @@ -17,7 +17,6 @@ 0B4CB3D428EAF19100246E62 /* SwiftLeedsAppClip.app in Embed App Clips */ = {isa = PBXBuildFile; fileRef = 0B4CB3C528EAF19000246E62 /* SwiftLeedsAppClip.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 0B4CB3DD28EAF57900246E62 /* MyConferenceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AECB295827417F9D00CDC983 /* MyConferenceView.swift */; }; 0B4CB3DE28EAF57E00246E62 /* MyConferenceViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEDC22522898281300746247 /* MyConferenceViewModel.swift */; }; - 0B4CB3DF28EAF58400246E62 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE32CDEF286CCF9D00DF0AFF /* Constants.swift */; }; 0B4CB3E028EAF58A00246E62 /* Schedule.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEDC22542898288F00746247 /* Schedule.swift */; }; 0B4CB3E328EAF5A200246E62 /* Activity.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8C1B2128BFCF4700AF7318 /* Activity.swift */; }; 0B4CB3E428EAF5AF00246E62 /* Presentation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8C1B2328BFCFC700AF7318 /* Presentation.swift */; }; @@ -68,7 +67,6 @@ 74B14FB028CE21D7004C0A40 /* TimeineProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74B14FAF28CE21D7004C0A40 /* TimeineProvider.swift */; }; 74B14FB228CE2221004C0A40 /* SwiftLeedsWidgetEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74B14FB128CE2221004C0A40 /* SwiftLeedsWidgetEntry.swift */; }; 74B14FB428CE2245004C0A40 /* SwiftLeedsWidgetEntryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74B14FB328CE2245004C0A40 /* SwiftLeedsWidgetEntryView.swift */; }; - 74E62F7028CA68D2004422F9 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE32CDEF286CCF9D00DF0AFF /* Constants.swift */; }; 74E62F7228CA98EA004422F9 /* SwiftLeedsSmallWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74E62F7128CA98EA004422F9 /* SwiftLeedsSmallWidgetView.swift */; }; 74E62F7428CAAB30004422F9 /* SwiftLeedsMediumWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74E62F7328CAAB30004422F9 /* SwiftLeedsMediumWidgetView.swift */; }; 74E62F7728CADBD8004422F9 /* Schedule.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEDC22542898288F00746247 /* Schedule.swift */; }; @@ -94,7 +92,6 @@ 7BE081542EE5BF13004BCD1F /* SharedAssets in Frameworks */ = {isa = PBXBuildFile; productRef = 7BE081532EE5BF13004BCD1F /* SharedAssets */; }; AE1C8010289E9F3800996659 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE1C800F289E9F3800996659 /* String.swift */; }; AE1C801428A7BCD000996659 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = AE1C801328A7BCD000996659 /* Settings.bundle */; }; - AE32CDF0286CCF9D00DF0AFF /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE32CDEF286CCF9D00DF0AFF /* Constants.swift */; }; AE5EFD73289DC1D000464FE1 /* CachedAsyncImage in Frameworks */ = {isa = PBXBuildFile; productRef = AE5EFD72289DC1D000464FE1 /* CachedAsyncImage */; }; AE5EFD75289E7CBF00464FE1 /* ActivityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE5EFD74289E7CBF00464FE1 /* ActivityView.swift */; }; AE8C1B2228BFCF4700AF7318 /* Activity.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8C1B2128BFCF4700AF7318 /* Activity.swift */; }; @@ -228,7 +225,6 @@ 7B8108412E5CA00E00CCB2F5 /* SwiftLeedsPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = SwiftLeedsPackage; sourceTree = ""; }; AE1C800F289E9F3800996659 /* String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = ""; }; AE1C801328A7BCD000996659 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; - AE32CDEF286CCF9D00DF0AFF /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; AE5EFD74289E7CBF00464FE1 /* ActivityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityView.swift; sourceTree = ""; }; AE8C1B2128BFCF4700AF7318 /* Activity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Activity.swift; sourceTree = ""; }; AE8C1B2328BFCFC700AF7318 /* Presentation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Presentation.swift; sourceTree = ""; }; @@ -479,7 +475,6 @@ AECB29862741AC5800CDC983 /* App */ = { isa = PBXGroup; children = ( - AE32CDEF286CCF9D00DF0AFF /* Constants.swift */, AECB29832741ABFD00CDC983 /* Info.plist */, AECB295627417F9D00CDC983 /* SwiftLeedsApp.swift */, 740162D92A7053A000C2D1B3 /* AppState.swift */, @@ -803,7 +798,6 @@ files = ( 0B4CB3E028EAF58A00246E62 /* Schedule.swift in Sources */, 0B4CB3EE28EAF5FB00246E62 /* String.swift in Sources */, - 0B4CB3DF28EAF58400246E62 /* Constants.swift in Sources */, 0B4CB3F128EAF61000246E62 /* StackedTileView.swift in Sources */, 0B4CB3DE28EAF57E00246E62 /* MyConferenceViewModel.swift in Sources */, AE9367902A93467500F2DB3F /* ScheduleView.swift in Sources */, @@ -848,7 +842,6 @@ 74E62F7A28CAE4DF004422F9 /* Speaker.swift in Sources */, 74E62F7728CADBD8004422F9 /* Schedule.swift in Sources */, 74B14FB228CE2221004C0A40 /* SwiftLeedsWidgetEntry.swift in Sources */, - 74E62F7028CA68D2004422F9 /* Constants.swift in Sources */, 74B14FB428CE2245004C0A40 /* SwiftLeedsWidgetEntryView.swift in Sources */, 0B59B5732E70EA6600820C3C /* About.swift in Sources */, ); @@ -895,7 +888,6 @@ FA57DE482875B06500911F03 /* StackedTileView.swift in Sources */, FA534D8228A1909300A3BFBB /* Local.swift in Sources */, AE93678F2A93455400F2DB3F /* ScheduleView.swift in Sources */, - AE32CDF0286CCF9D00DF0AFF /* Constants.swift in Sources */, FA57DE472875B06500911F03 /* CommonTileView.swift in Sources */, FA57DE462875B06500911F03 /* CommonTileButton.swift in Sources */, 74F5EF852A49CE6A008D9413 /* TabsMainView.swift in Sources */, diff --git a/SwiftLeeds/App/Constants.swift b/SwiftLeeds/App/Constants.swift deleted file mode 100644 index d2a563a..0000000 --- a/SwiftLeeds/App/Constants.swift +++ /dev/null @@ -1,10 +0,0 @@ -import CoreGraphics - -enum Assets { - enum Image { - static let carriageworksTheatre = "CarriageworksTheatre" - static let leedsPlayhouse = "LeedsPlayhouse" - static let swiftLeedsIcon = "SwiftLeedsIcon" - static let swiftLeedsIconWithNoBackground = "Icon" - } -} diff --git a/SwiftLeeds/Views/About/AboutView.swift b/SwiftLeeds/Views/About/AboutView.swift index 9b19e97..9d05b0f 100644 --- a/SwiftLeeds/Views/About/AboutView.swift +++ b/SwiftLeeds/Views/About/AboutView.swift @@ -39,7 +39,7 @@ struct AboutView: View { VStack(spacing: Padding.cellGap) { FancyHeaderView( title: "About", - foregroundImageName: Assets.Image.swiftLeedsIcon + foregroundImage: Image.swiftLeedsIcon ) VStack(spacing: Padding.cellGap) { diff --git a/SwiftLeeds/Views/Components/FancyHeaderView.swift b/SwiftLeeds/Views/Components/FancyHeaderView.swift index 66d82a0..587460a 100644 --- a/SwiftLeeds/Views/Components/FancyHeaderView.swift +++ b/SwiftLeeds/Views/Components/FancyHeaderView.swift @@ -1,11 +1,12 @@ import CachedAsyncImage import DesignKit +import SharedAssets import SwiftUI struct FancyHeaderView: View { private let title: String private let foregroundImageURLs: [URL] - private let foregroundImageName: String? + private let foregroundImage: Image? private let foregroundImageWidth: Double = 160 private let aspectRatio = 1.66 @@ -13,10 +14,10 @@ struct FancyHeaderView: View { @State private var foregroundGroupViewHeight: CGFloat = .zero // MARK: - Initialisers - init(title: String, foregroundImageURLs: [URL] = [], foregroundImageName: String? = nil) { + init(title: String, foregroundImageURLs: [URL] = [], foregroundImage: Image? = nil) { self.title = title self.foregroundImageURLs = foregroundImageURLs - self.foregroundImageName = foregroundImageName + self.foregroundImage = foregroundImage } var body: some View { @@ -25,7 +26,7 @@ struct FancyHeaderView: View { .edgesIgnoringSafeArea(.top) .aspectRatio(aspectRatio, contentMode: .fill) .background( - createRectangleImage(for: Image(Assets.Image.leedsPlayhouse), aspectRatio: aspectRatio) + createRectangleImage(for: Image.leedsPlayhouse, aspectRatio: aspectRatio) .aspectRatio(contentMode: .fill) .accessibilityHidden(true) ) @@ -70,17 +71,17 @@ struct FancyHeaderView: View { createRectangleImage(for: image) .accessibilityHidden(true) case .failure(_): - createRectangleImage(for: Image(Assets.Image.swiftLeedsIcon)) + createRectangleImage(for: Image.swiftLeedsIcon) @unknown default: loadingView() } } } } - } else if let foregroundImageName = foregroundImageName { - createRectangleImage(for: Image(foregroundImageName)) + } else if let foregroundImage = foregroundImage { + createRectangleImage(for: foregroundImage) } else { - createRectangleImage(for: Image(Assets.Image.swiftLeedsIcon)) + createRectangleImage(for: Image.swiftLeedsIcon) } } @@ -107,7 +108,7 @@ struct FancyHeaderView: View { } private var foregroundImageCount: Int { - let count = foregroundImageURLs.count + (foregroundImageName == nil ? 0 : 1) + let count = foregroundImageURLs.count + (foregroundImage == nil ? 0 : 1) // Ensure we always have at least 1 for the fallback image return count == 0 ? 1 : count } @@ -122,22 +123,32 @@ struct FancyHeaderView_Previews: PreviewProvider { Group { VStack { Text(verbatim: "Local Asset") - FancyHeaderView(title: "Some Long Text here", - foregroundImageName: Assets.Image.swiftLeedsIcon) + FancyHeaderView( + title: "Some Long Text here", + foregroundImage: Image.swiftLeedsIcon + ) Text(verbatim: "Remote Data") - FancyHeaderView(title: "Swift Taylor", - foregroundImageURLs: [URL(string: "https://cdn-az.allevents.in/events5/banners/458482c4fc7489448aa3d77f6e2cd5d0553fa5edd7178dbf18cf986d2172eaf2-rimg-w1200-h675-gmir.jpg?v=1655230338")!]) + FancyHeaderView( + title: "Swift Taylor", + foregroundImageURLs: [URL(string: "https://cdn-az.allevents.in/events5/banners/458482c4fc7489448aa3d77f6e2cd5d0553fa5edd7178dbf18cf986d2172eaf2-rimg-w1200-h675-gmir.jpg?v=1655230338")!] + ) } ScrollView { Text(verbatim: "Local Asset") VStack { - FancyHeaderView(title: "Kannan Prasad", - foregroundImageName: Assets.Image.swiftLeedsIcon) + FancyHeaderView( + title: "Kannan Prasad", + foregroundImage: Image.swiftLeedsIcon + ) } Text(verbatim: "Remote Data") - FancyHeaderView(title: "Swift Taylor", - foregroundImageURLs: [URL(string: "https://cdn-az.allevents.in/events5/banners/458482c4fc7489448aa3d77f6e2cd5d0553fa5edd7178dbf18cf986d2172eaf2-rimg-w1200-h675-gmir.jpg?v=1655230338")!]) + FancyHeaderView( + title: "Swift Taylor", + foregroundImageURLs: [ + URL(string: "https://cdn-az.allevents.in/events5/banners/458482c4fc7489448aa3d77f6e2cd5d0553fa5edd7178dbf18cf986d2172eaf2-rimg-w1200-h675-gmir.jpg?v=1655230338")! + ] + ) } } } diff --git a/SwiftLeeds/Views/Sponsors/SponsorsView.swift b/SwiftLeeds/Views/Sponsors/SponsorsView.swift index 4d81870..909eb19 100644 --- a/SwiftLeeds/Views/Sponsors/SponsorsView.swift +++ b/SwiftLeeds/Views/Sponsors/SponsorsView.swift @@ -14,7 +14,7 @@ struct SponsorsView: View { VStack(spacing: 0) { FancyHeaderView( title: "Sponsors", - foregroundImageName: Assets.Image.swiftLeedsIcon + foregroundImage: Image.swiftLeedsIcon ) if isLoading { diff --git a/SwiftLeedsWidget/SwiftLeedsMediumWidgetView.swift b/SwiftLeedsWidget/SwiftLeedsMediumWidgetView.swift index 59a660b..4b5508c 100644 --- a/SwiftLeedsWidget/SwiftLeedsMediumWidgetView.swift +++ b/SwiftLeedsWidget/SwiftLeedsMediumWidgetView.swift @@ -76,7 +76,7 @@ extension SwiftLeedsMediumWidgetView { } private var logoView: some View { - Image(Assets.Image.swiftLeedsIconWithNoBackground) + Image.swiftLeedsIcon .resizable() .aspectRatio(contentMode: .fill) .transition(.opacity) @@ -88,11 +88,29 @@ extension SwiftLeedsMediumWidgetView { struct SwiftLeedsMediumWidgetView_Previews: PreviewProvider { static var previews: some View { - SwiftLeedsMediumWidgetView(slot: Schedule.Slot(id: UUID(), date: Date(), startTime: "11:00 AM", duration: 1, activity: nil, presentation: Presentation.donnyWalls)) - .previewContext(WidgetPreviewContext(family: .systemMedium)) + SwiftLeedsMediumWidgetView( + slot: Schedule.Slot( + id: UUID(), + date: Date(), + startTime: "11:00 AM", + duration: 1, + activity: nil, + presentation: Presentation.donnyWalls + ) + ) + .previewContext(WidgetPreviewContext(family: .systemMedium)) - SwiftLeedsMediumWidgetView(slot: Schedule.Slot(id: UUID(), date: Date(), startTime: "11:00 AM", duration: 1, activity: nil, presentation: Presentation.donnyWalls)) - .environment(\.colorScheme, .dark) - .previewContext(WidgetPreviewContext(family: .systemMedium)) + SwiftLeedsMediumWidgetView( + slot: Schedule.Slot( + id: UUID(), + date: Date(), + startTime: "11:00 AM", + duration: 1, + activity: nil, + presentation: Presentation.donnyWalls + ) + ) + .environment(\.colorScheme, .dark) + .previewContext(WidgetPreviewContext(family: .systemMedium)) } } diff --git a/SwiftLeedsWidget/SwiftLeedsSmallWidgetView.swift b/SwiftLeedsWidget/SwiftLeedsSmallWidgetView.swift index 3ab2d33..de5e6bc 100644 --- a/SwiftLeedsWidget/SwiftLeedsSmallWidgetView.swift +++ b/SwiftLeedsWidget/SwiftLeedsSmallWidgetView.swift @@ -1,9 +1,10 @@ +import SharedAssets import SwiftUI import WidgetKit struct SwiftLeedsSmallWidgetView: View { - // MARK: - Pivate Properties + // MARK: - Private Properties private let slot: Schedule.Slot @@ -65,7 +66,7 @@ extension SwiftLeedsSmallWidgetView { } private var logoView: some View { - Image(Assets.Image.swiftLeedsIconWithNoBackground) + Image.swiftLeedsIcon .resizable() .aspectRatio(contentMode: .fill) .transition(.opacity)