diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Loaf/Loaf.podspec b/Loaf.podspec similarity index 96% rename from Loaf/Loaf.podspec rename to Loaf.podspec index 71ca242..bcbe01b 100644 --- a/Loaf/Loaf.podspec +++ b/Loaf.podspec @@ -62,8 +62,8 @@ Pod::Spec.new do |s| # # s.platform = :ios - s.platform = :ios, "11.0" - s.swift_version = "4.2" + s.platform = :ios, "9.0" + s.swift_version = "5.1" # When using multiple platforms # s.ios.deployment_target = "5.0" @@ -78,7 +78,7 @@ Pod::Spec.new do |s| # Supports git, hg, bzr, svn and HTTP. # - s.source = { :git => "https://github.com/schmidyy/Loaf.git", :tag => "#{s.version}" } + s.source = { :git => "https://github.com/schmidyy/Loaf.git", :tag => "#{s.version}" } # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # @@ -89,7 +89,7 @@ Pod::Spec.new do |s| # Not including the public_header_files will make all headers public. # - s.source_files = 'Loaf/**/*.{h,swift}' + s.source_files = 'Sources/**/*.{h,swift}' # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # diff --git a/Loaf/Loaf.xcodeproj/project.pbxproj b/Loaf/Loaf.xcodeproj/project.pbxproj index 18d0d2e..e3bd0df 100644 --- a/Loaf/Loaf.xcodeproj/project.pbxproj +++ b/Loaf/Loaf.xcodeproj/project.pbxproj @@ -7,25 +7,25 @@ objects = { /* Begin PBXBuildFile section */ - 2713A99B2209236700B149C5 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2713A99A2209236700B149C5 /* Extensions.swift */; }; - 277E5A46220A27A90054B81E /* Manager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277E5A45220A27A90054B81E /* Manager.swift */; }; - 277E5A48220A28580054B81E /* Controller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277E5A47220A28580054B81E /* Controller.swift */; }; - 277E5A4A220A2A840054B81E /* Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277E5A49220A2A840054B81E /* Animator.swift */; }; 27D9BD012208FFCC008064DF /* Loaf.h in Headers */ = {isa = PBXBuildFile; fileRef = 27D9BCFF2208FFCC008064DF /* Loaf.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 27D9BD0822090D1E008064DF /* Loaf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27D9BD0722090D1E008064DF /* Loaf.swift */; }; - 27DD00252227287600DE9171 /* Icons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27DD00242227287600DE9171 /* Icons.swift */; }; + 84DA601D234329880088680A /* Manager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DA6017234329880088680A /* Manager.swift */; }; + 84DA601E234329880088680A /* Controller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DA6018234329880088680A /* Controller.swift */; }; + 84DA601F234329880088680A /* Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DA6019234329880088680A /* Animator.swift */; }; + 84DA6020234329880088680A /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DA601A234329880088680A /* Extensions.swift */; }; + 84DA6021234329880088680A /* Icons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DA601B234329880088680A /* Icons.swift */; }; + 84DA6022234329880088680A /* Loaf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DA601C234329880088680A /* Loaf.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 2713A99A2209236700B149C5 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; - 277E5A45220A27A90054B81E /* Manager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Manager.swift; sourceTree = ""; }; - 277E5A47220A28580054B81E /* Controller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Controller.swift; sourceTree = ""; }; - 277E5A49220A2A840054B81E /* Animator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Animator.swift; sourceTree = ""; }; 27D9BCFC2208FFCC008064DF /* Loaf.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Loaf.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 27D9BCFF2208FFCC008064DF /* Loaf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Loaf.h; sourceTree = ""; }; 27D9BD002208FFCC008064DF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 27D9BD0722090D1E008064DF /* Loaf.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Loaf.swift; sourceTree = ""; }; - 27DD00242227287600DE9171 /* Icons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Icons.swift; sourceTree = ""; }; + 84DA6017234329880088680A /* Manager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Manager.swift; sourceTree = ""; }; + 84DA6018234329880088680A /* Controller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Controller.swift; sourceTree = ""; }; + 84DA6019234329880088680A /* Animator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Animator.swift; sourceTree = ""; }; + 84DA601A234329880088680A /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; + 84DA601B234329880088680A /* Icons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Icons.swift; sourceTree = ""; }; + 84DA601C234329880088680A /* Loaf.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Loaf.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -39,16 +39,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 2713A99922091B9200B149C5 /* Presenter */ = { - isa = PBXGroup; - children = ( - 277E5A45220A27A90054B81E /* Manager.swift */, - 277E5A47220A28580054B81E /* Controller.swift */, - 277E5A49220A2A840054B81E /* Animator.swift */, - ); - path = Presenter; - sourceTree = ""; - }; 27D9BCF22208FFCC008064DF = { isa = PBXGroup; children = ( @@ -68,16 +58,43 @@ 27D9BCFE2208FFCC008064DF /* Loaf */ = { isa = PBXGroup; children = ( - 27DD00242227287600DE9171 /* Icons.swift */, - 27D9BD0722090D1E008064DF /* Loaf.swift */, - 2713A99A2209236700B149C5 /* Extensions.swift */, - 2713A99922091B9200B149C5 /* Presenter */, + 84DA6014234329880088680A /* Sources */, 27D9BCFF2208FFCC008064DF /* Loaf.h */, 27D9BD002208FFCC008064DF /* Info.plist */, ); path = Loaf; sourceTree = ""; }; + 84DA6014234329880088680A /* Sources */ = { + isa = PBXGroup; + children = ( + 84DA6015234329880088680A /* Loaf */, + ); + name = Sources; + path = ../../Sources; + sourceTree = ""; + }; + 84DA6015234329880088680A /* Loaf */ = { + isa = PBXGroup; + children = ( + 84DA6016234329880088680A /* Presenter */, + 84DA601A234329880088680A /* Extensions.swift */, + 84DA601B234329880088680A /* Icons.swift */, + 84DA601C234329880088680A /* Loaf.swift */, + ); + path = Loaf; + sourceTree = ""; + }; + 84DA6016234329880088680A /* Presenter */ = { + isa = PBXGroup; + children = ( + 84DA6017234329880088680A /* Manager.swift */, + 84DA6018234329880088680A /* Controller.swift */, + 84DA6019234329880088680A /* Animator.swift */, + ); + path = Presenter; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -121,7 +138,7 @@ TargetAttributes = { 27D9BCFB2208FFCC008064DF = { CreatedOnToolsVersion = 10.1; - LastSwiftMigration = 1010; + LastSwiftMigration = 1100; }; }; }; @@ -157,12 +174,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 277E5A4A220A2A840054B81E /* Animator.swift in Sources */, - 2713A99B2209236700B149C5 /* Extensions.swift in Sources */, - 27DD00252227287600DE9171 /* Icons.swift in Sources */, - 277E5A46220A27A90054B81E /* Manager.swift in Sources */, - 27D9BD0822090D1E008064DF /* Loaf.swift in Sources */, - 277E5A48220A28580054B81E /* Controller.swift in Sources */, + 84DA601F234329880088680A /* Animator.swift in Sources */, + 84DA6022234329880088680A /* Loaf.swift in Sources */, + 84DA601D234329880088680A /* Manager.swift in Sources */, + 84DA601E234329880088680A /* Controller.swift in Sources */, + 84DA6021234329880088680A /* Icons.swift in Sources */, + 84DA6020234329880088680A /* Extensions.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -221,7 +238,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -279,7 +296,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -313,7 +330,7 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -339,7 +356,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.matschmid.Loaf; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..6c90d0f --- /dev/null +++ b/Package.swift @@ -0,0 +1,25 @@ +// swift-tools-version:5.1 + +import PackageDescription + +let package = Package( + name: "Loaf", + platforms: [ + .iOS(.v9) + ], + products: [ + .library( + name: "Loaf", + targets: ["Loaf"] + ), + ], + dependencies: [], + targets: [ + .target( + name: "Loaf", + dependencies: []), + .testTarget( + name: "LoafTests", + dependencies: ["Loaf"]), + ] +) diff --git a/Loaf/Loaf/Extensions.swift b/Sources/Loaf/Extensions.swift similarity index 99% rename from Loaf/Loaf/Extensions.swift rename to Sources/Loaf/Extensions.swift index ca9ab0d..8dba5ff 100644 --- a/Loaf/Loaf/Extensions.swift +++ b/Sources/Loaf/Extensions.swift @@ -6,7 +6,7 @@ // Copyright © 2019 Mat Schmid. All rights reserved. // -import Foundation +import UIKit extension UIViewController { func presentToast(_ smartToastViewController: LoafViewController) { diff --git a/Loaf/Loaf/Icons.swift b/Sources/Loaf/Icons.swift similarity index 99% rename from Loaf/Loaf/Icons.swift rename to Sources/Loaf/Icons.swift index 6c1619e..b6288c4 100644 --- a/Loaf/Loaf/Icons.swift +++ b/Sources/Loaf/Icons.swift @@ -9,8 +9,6 @@ import UIKit - - class Icons: NSObject { diff --git a/Loaf/Loaf/Loaf.swift b/Sources/Loaf/Loaf.swift similarity index 97% rename from Loaf/Loaf/Loaf.swift rename to Sources/Loaf/Loaf.swift index c2f86e3..c256f1a 100644 --- a/Loaf/Loaf/Loaf.swift +++ b/Sources/Loaf/Loaf.swift @@ -56,7 +56,15 @@ final public class Loaf { /// The width of the loaf let width: Width - public init(backgroundColor: UIColor, textColor: UIColor = .white, tintColor: UIColor = .white, font: UIFont = UIFont.systemFont(ofSize: 14, weight: .medium), icon: UIImage? = Icon.info, textAlignment: NSTextAlignment = .left, iconAlignment: IconAlignment = .left, width: Width = .fixed(280)) { + public init( + backgroundColor: UIColor, + textColor: UIColor = .white, + tintColor: UIColor = .white, + font: UIFont = .systemFont(ofSize: 14, weight: .medium), + icon: UIImage? = Icon.info, + textAlignment: NSTextAlignment = .left, + iconAlignment: IconAlignment = .left, + width: Width = .fixed(280)) { self.backgroundColor = backgroundColor self.textColor = textColor self.tintColor = tintColor diff --git a/Loaf/Loaf/Presenter/Animator.swift b/Sources/Loaf/Presenter/Animator.swift similarity index 100% rename from Loaf/Loaf/Presenter/Animator.swift rename to Sources/Loaf/Presenter/Animator.swift diff --git a/Loaf/Loaf/Presenter/Controller.swift b/Sources/Loaf/Presenter/Controller.swift similarity index 100% rename from Loaf/Loaf/Presenter/Controller.swift rename to Sources/Loaf/Presenter/Controller.swift diff --git a/Loaf/Loaf/Presenter/Manager.swift b/Sources/Loaf/Presenter/Manager.swift similarity index 100% rename from Loaf/Loaf/Presenter/Manager.swift rename to Sources/Loaf/Presenter/Manager.swift diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..63e480c --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,7 @@ +import XCTest + +import LoafTests + +var tests = [XCTestCaseEntry]() +tests += LoafTests.allTests() +XCTMain(tests) diff --git a/Tests/LoafTests/LoafTests.swift b/Tests/LoafTests/LoafTests.swift new file mode 100644 index 0000000..83c4ea0 --- /dev/null +++ b/Tests/LoafTests/LoafTests.swift @@ -0,0 +1,12 @@ +import XCTest +@testable import Loaf + +final class LoafTests: XCTestCase { + func testExample() { + XCTAssertEqual("Equal", "Equal") + } + + static var allTests = [ + ("testExample", testExample), + ] +} diff --git a/Tests/LoafTests/XCTestManifests.swift b/Tests/LoafTests/XCTestManifests.swift new file mode 100644 index 0000000..6469dc5 --- /dev/null +++ b/Tests/LoafTests/XCTestManifests.swift @@ -0,0 +1,9 @@ +import XCTest + +#if !canImport(ObjectiveC) +public func allTests() -> [XCTestCaseEntry] { + return [ + testCase(LoafTests.allTests), + ] +} +#endif