From 44672f2f9b85ab447c2346e7a42c1f2b150d4747 Mon Sep 17 00:00:00 2001 From: Praveen P Date: Thu, 24 Oct 2024 23:28:17 -0400 Subject: [PATCH] Added SwiftUI MobileTheme library as MobileTheming --- .../project.pbxproj | 27 ++++++++++++------- .../xcshareddata/swiftpm/Package.resolved | 10 +++---- Example/MobileCoreExample/AppDelegate.swift | 2 +- .../Classes/SampleTableViewController.swift | 2 +- MobileCore.podspec | 15 +++++++---- Package.swift | 11 +++++--- Sources/MobileTheming/ThemesManager.swift | 15 +++++++++++ 7 files changed, 58 insertions(+), 24 deletions(-) create mode 100644 Sources/MobileTheming/ThemesManager.swift diff --git a/Example/MobileCoreExample.xcodeproj/project.pbxproj b/Example/MobileCoreExample.xcodeproj/project.pbxproj index 908b51c..79ce4be 100644 --- a/Example/MobileCoreExample.xcodeproj/project.pbxproj +++ b/Example/MobileCoreExample.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -12,6 +12,7 @@ D44E56F92341CFAB00A0E56C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D44E56F82341CFAB00A0E56C /* UIKit.framework */; }; D49FE3182345D45A002B3742 /* SampleTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49FE3162345D459002B3742 /* SampleTableViewController.swift */; }; D49FE3192345D45A002B3742 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D49FE3172345D459002B3742 /* ViewController.swift */; }; + D4E050642CCB470B0028D1CE /* MobileTheming in Frameworks */ = {isa = PBXBuildFile; productRef = D4E050632CCB470B0028D1CE /* MobileTheming */; }; DE2A6A3426A4199A001F1FF3 /* AppTheming in Frameworks */ = {isa = PBXBuildFile; productRef = DE2A6A3326A4199A001F1FF3 /* AppTheming */; }; DE2A6A3626A4199A001F1FF3 /* CoreComponents in Frameworks */ = {isa = PBXBuildFile; productRef = DE2A6A3526A4199A001F1FF3 /* CoreComponents */; }; DE2A6A3826A4199A001F1FF3 /* CoreUtility in Frameworks */ = {isa = PBXBuildFile; productRef = DE2A6A3726A4199A001F1FF3 /* CoreUtility */; }; @@ -99,6 +100,7 @@ buildActionMask = 2147483647; files = ( DE2A6A3826A4199A001F1FF3 /* CoreUtility in Frameworks */, + D4E050642CCB470B0028D1CE /* MobileTheming in Frameworks */, DE2A6A3C26A419A3001F1FF3 /* Foundation.framework in Frameworks */, DE2A6A3626A4199A001F1FF3 /* CoreComponents in Frameworks */, DE2A6A3A26A4199A001F1FF3 /* NetworkLayer in Frameworks */, @@ -273,6 +275,7 @@ DE2A6A3526A4199A001F1FF3 /* CoreComponents */, DE2A6A3726A4199A001F1FF3 /* CoreUtility */, DE2A6A3926A4199A001F1FF3 /* NetworkLayer */, + D4E050632CCB470B0028D1CE /* MobileTheming */, ); productName = FTMobileCoreSample; productReference = DE9221C91EF28CDF000C8FC7 /* MobileCoreExample.app */; @@ -440,7 +443,7 @@ DEVELOPMENT_TEAM = W6W48SVQX7; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = MobileCoreTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -471,7 +474,7 @@ DEVELOPMENT_TEAM = W6W48SVQX7; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = MobileCoreTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -540,7 +543,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.6; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; OTHER_SWIFT_FLAGS = "-Onone"; @@ -548,7 +551,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_TREAT_WARNINGS_AS_ERRORS = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -599,14 +602,14 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.6; MTL_ENABLE_DEBUG_INFO = NO; OTHER_SWIFT_FLAGS = ""; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_TREAT_WARNINGS_AS_ERRORS = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -625,7 +628,8 @@ DEVELOPMENT_TEAM = W6W48SVQX7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(TARGET_NAME)/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools"; + IPHONEOS_DEPLOYMENT_TARGET = 16.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -656,7 +660,8 @@ DEVELOPMENT_TEAM = W6W48SVQX7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(TARGET_NAME)/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools"; + IPHONEOS_DEPLOYMENT_TARGET = 16.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -716,6 +721,10 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ + D4E050632CCB470B0028D1CE /* MobileTheming */ = { + isa = XCSwiftPackageProductDependency; + productName = MobileTheming; + }; DE2A6A3326A4199A001F1FF3 /* AppTheming */ = { isa = XCSwiftPackageProductDependency; productName = AppTheming; diff --git a/Example/MobileCoreExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example/MobileCoreExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index d2ede1c..dc4d8d0 100644 --- a/Example/MobileCoreExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Example/MobileCoreExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -2,12 +2,12 @@ "object": { "pins": [ { - "package": "MobileCore", - "repositoryURL": "https://github.com/ppraveentr/MobileCore.git", + "package": "MobileTheme", + "repositoryURL": "https://github.com/ppraveentr/MobileTheme.git", "state": { - "branch": "feature/SPM-Setup", - "revision": "272f5ac227e18869e191ca2474e7da74394c26a2", - "version": null + "branch": null, + "revision": "8e321347fc520ea04d1fa6e49a0bd5765cc4f49b", + "version": "1.2.0" } } ] diff --git a/Example/MobileCoreExample/AppDelegate.swift b/Example/MobileCoreExample/AppDelegate.swift index 9426304..557a1cd 100644 --- a/Example/MobileCoreExample/AppDelegate.swift +++ b/Example/MobileCoreExample/AppDelegate.swift @@ -13,7 +13,7 @@ import NetworkLayer import AppTheming #endif -@UIApplicationMain +@main class AppDelegate: UIResponder, UIApplicationDelegate { var kBundle = Bundle(for: AppDelegate.self) var window: UIWindow? diff --git a/Example/MobileCoreExample/Classes/SampleTableViewController.swift b/Example/MobileCoreExample/Classes/SampleTableViewController.swift index 3a6c8da..611ff16 100644 --- a/Example/MobileCoreExample/Classes/SampleTableViewController.swift +++ b/Example/MobileCoreExample/Classes/SampleTableViewController.swift @@ -12,7 +12,7 @@ import AppTheming import CoreComponents #endif -class SampleTableViewController: UIViewController, TableViewControllerProtocol { +class SampleTableViewController: UIViewController, @preconcurrency TableViewControllerProtocol { @IBOutlet var footerView: UIView! diff --git a/MobileCore.podspec b/MobileCore.podspec index 98f6630..c3b01ae 100644 --- a/MobileCore.podspec +++ b/MobileCore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'MobileCore' - s.version = '0.1.3' + s.version = '0.1.5' s.summary = 'MobileCore framework.' s.homepage = 'https://github.com/ppraveentr/MobileCore' s.license = { :type => 'MIT', :file => 'LICENSE' } @@ -8,9 +8,9 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/ppraveentr/MobileCore.git', :tag => s.version.to_s } s.weak_framework = 'UIKit' - s.ios.deployment_target = '10.0' - s.swift_version = '5.0' - s.default_subspecs = 'CoreUtility', 'NetworkLayer', 'CoreComponents', 'AppTheming' + s.ios.deployment_target = '16.0' + s.swift_version = '6.0' + s.default_subspecs = 'CoreUtility', 'NetworkLayer', 'CoreComponents', 'AppTheming', 'MobileTheming' s.subspec 'CoreUtility' do |utility| utility.source_files = 'Sources/CoreUtility/**/*.{h,m,swift}' @@ -35,5 +35,10 @@ Pod::Spec.new do |s| coreComponents.dependency 'MobileCore/CoreUtility' coreComponents.header_dir = "CoreComponents" end - + + s.subspec 'MobileTheming' do |theme| + theme.source_files = 'Sources/MobileTheming/**/*.{h,m,swift}' + theme.header_dir = "MobileTheming" + end + end diff --git a/Package.swift b/Package.swift index 29e6120..4da31c9 100644 --- a/Package.swift +++ b/Package.swift @@ -8,16 +8,18 @@ private let resources: [Resource] = [ .process("Resources") ] let package = Package( name: "MobileCore", - platforms: [.iOS(.v10)], + platforms: [.iOS(.v14)], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library(name: "CoreUtility", targets: ["CoreUtility"]), .library(name: "CoreComponents", targets: ["CoreComponents"]), .library(name: "AppTheming", targets: ["AppTheming"]), - .library(name: "NetworkLayer", targets: ["NetworkLayer"]) + .library(name: "NetworkLayer", targets: ["NetworkLayer"]), + .library(name: "MobileTheming", targets: ["MobileTheming"]) ], dependencies: [ // .package(url: /* package url */, from: "1.0.0"), + .package(name: "MobileTheme", url: "https://github.com/ppraveentr/MobileTheme.git", from: "1.2.0") ], targets: [ // MARK: CoreUtility @@ -34,7 +36,10 @@ let package = Package( // MARK: NetworkLayer .target(name: "NetworkLayer", dependencies: dependencies), - .testTarget(name: "NetworkLayerTests", dependencies: dependencies + ["NetworkLayer"], resources: resources) + .testTarget(name: "NetworkLayerTests", dependencies: dependencies + ["NetworkLayer"], resources: resources), + + // MARK: SwiftUI Theming + .target(name: "MobileTheming", dependencies: ["MobileTheme"]) ], swiftLanguageVersions: [.v5] ) diff --git a/Sources/MobileTheming/ThemesManager.swift b/Sources/MobileTheming/ThemesManager.swift new file mode 100644 index 0000000..521fb72 --- /dev/null +++ b/Sources/MobileTheming/ThemesManager.swift @@ -0,0 +1,15 @@ +// +// ThemesManager.swift +// MobileCore +// +// Created by Praveen Prabhakar on 10/24/24. +// + +#if canImport(MobileTheming) +//import CoreUtility +#endif +import Foundation +import SwiftUI + +open class ThemesManager { +}