Skip to content

Commit

Permalink
Add SPM support and migrate to Swift 5.1 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi authored and Mat Schmid committed Nov 1, 2019
1 parent b57c24d commit dea0ff7
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 45 deletions.
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Loaf/Loaf.podspec → Loaf.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
Expand All @@ -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 ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
Expand Down
91 changes: 54 additions & 37 deletions Loaf/Loaf.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<group>"; };
277E5A45220A27A90054B81E /* Manager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Manager.swift; sourceTree = "<group>"; };
277E5A47220A28580054B81E /* Controller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Controller.swift; sourceTree = "<group>"; };
277E5A49220A2A840054B81E /* Animator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Animator.swift; sourceTree = "<group>"; };
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 = "<group>"; };
27D9BD002208FFCC008064DF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
27D9BD0722090D1E008064DF /* Loaf.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Loaf.swift; sourceTree = "<group>"; };
27DD00242227287600DE9171 /* Icons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Icons.swift; sourceTree = "<group>"; };
84DA6017234329880088680A /* Manager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Manager.swift; sourceTree = "<group>"; };
84DA6018234329880088680A /* Controller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Controller.swift; sourceTree = "<group>"; };
84DA6019234329880088680A /* Animator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Animator.swift; sourceTree = "<group>"; };
84DA601A234329880088680A /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
84DA601B234329880088680A /* Icons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Icons.swift; sourceTree = "<group>"; };
84DA601C234329880088680A /* Loaf.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Loaf.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -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 = "<group>";
};
27D9BCF22208FFCC008064DF = {
isa = PBXGroup;
children = (
Expand All @@ -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 = "<group>";
};
84DA6014234329880088680A /* Sources */ = {
isa = PBXGroup;
children = (
84DA6015234329880088680A /* Loaf */,
);
name = Sources;
path = ../../Sources;
sourceTree = "<group>";
};
84DA6015234329880088680A /* Loaf */ = {
isa = PBXGroup;
children = (
84DA6016234329880088680A /* Presenter */,
84DA601A234329880088680A /* Extensions.swift */,
84DA601B234329880088680A /* Icons.swift */,
84DA601C234329880088680A /* Loaf.swift */,
);
path = Loaf;
sourceTree = "<group>";
};
84DA6016234329880088680A /* Presenter */ = {
isa = PBXGroup;
children = (
84DA6017234329880088680A /* Manager.swift */,
84DA6018234329880088680A /* Controller.swift */,
84DA6019234329880088680A /* Animator.swift */,
);
path = Presenter;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -121,7 +138,7 @@
TargetAttributes = {
27D9BCFB2208FFCC008064DF = {
CreatedOnToolsVersion = 10.1;
LastSwiftMigration = 1010;
LastSwiftMigration = 1100;
};
};
};
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
25 changes: 25 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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"]),
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2019 Mat Schmid. All rights reserved.
//

import Foundation
import UIKit

extension UIViewController {
func presentToast(_ smartToastViewController: LoafViewController) {
Expand Down
2 changes: 0 additions & 2 deletions Loaf/Loaf/Icons.swift → Sources/Loaf/Icons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

import UIKit



class Icons: NSObject {


Expand Down
10 changes: 9 additions & 1 deletion Loaf/Loaf/Loaf.swift → Sources/Loaf/Loaf.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import XCTest

import LoafTests

var tests = [XCTestCaseEntry]()
tests += LoafTests.allTests()
XCTMain(tests)
12 changes: 12 additions & 0 deletions Tests/LoafTests/LoafTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import XCTest
@testable import Loaf

final class LoafTests: XCTestCase {
func testExample() {
XCTAssertEqual("Equal", "Equal")
}

static var allTests = [
("testExample", testExample),
]
}
9 changes: 9 additions & 0 deletions Tests/LoafTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import XCTest

#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(LoafTests.allTests),
]
}
#endif

0 comments on commit dea0ff7

Please sign in to comment.