diff --git a/.gitignore b/.gitignore index 46c1604..d5c9e92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,52 @@ /Pods /Podfile.lock .DS_Store + +# Swift PM +Package.resolved + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +## Obj-C/Swift specific +*.hmap + +## App packaging +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +# Package.resolved +# *.xcodeproj +# +# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata +# hence it is not needed unless you have added a package configuration file to your project +.swiftpm + +.build/ diff --git a/.swiftpm/xcode/package.xcworkspace/xcuserdata/daniele.xcuserdatad/UserInterfaceState.xcuserstate b/.swiftpm/xcode/package.xcworkspace/xcuserdata/daniele.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 3eb199e..0000000 Binary files a/.swiftpm/xcode/package.xcworkspace/xcuserdata/daniele.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/Package.swift b/Package.swift index 8cc39ee..68a5d99 100644 --- a/Package.swift +++ b/Package.swift @@ -1,5 +1,4 @@ // swift-tools-version:5.3 -// The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -7,23 +6,15 @@ let package = Package( name: "ScrollStackController", platforms: [.iOS(.v11)], products: [ - // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "ScrollStackController", - targets: ["ScrollStackController"]), - ], - dependencies: [ - // Dependencies declare other packages that this package depends on. - // .package(url: /* package url */, from: "1.0.0"), + targets: ["ScrollStackController"] + ), ], targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "ScrollStackController", - dependencies: []), - .testTarget( - name: "ScrollStackControllerTests", - dependencies: ["ScrollStackController"]), + dependencies: [] + ), ] ) diff --git a/Sources/ScrollStackController/ScrollStack.swift b/Sources/ScrollStackController/ScrollStack.swift index 98a92f5..992f3a3 100644 --- a/Sources/ScrollStackController/ScrollStack.swift +++ b/Sources/ScrollStackController/ScrollStack.swift @@ -253,6 +253,7 @@ open class ScrollStack: UIScrollView, UIScrollViewDelegate { /// Remove all existing rows and put in place the new list based upon passed views. /// /// - Parameter views: views to set. + @discardableResult open func setRows(views: [UIView]) -> [ScrollStackRow] { removeAllRows(animated: false) return addRows(views: views) @@ -267,6 +268,7 @@ open class ScrollStack: UIScrollView, UIScrollViewDelegate { /// - location: location inside the stack of the new row. /// - animated: `true` to animate operation, by default is `false`. /// - completion: completion: optional completion callback to call at the end of insertion. + @discardableResult open func addRow(view: UIView, at location: InsertLocation = .bottom, animated: Bool = false, completion: (() -> Void)? = nil) -> ScrollStackRow? { guard let index = indexForLocation(location) else { return nil @@ -280,6 +282,7 @@ open class ScrollStack: UIScrollView, UIScrollViewDelegate { /// - Parameter controllers: controllers to add as rows. /// - Parameter location: location inside the stack of the new row. /// - Parameter animated: `true` to animate operatio, by default is `false`. + @discardableResult open func addRows(views: [UIView], at location: InsertLocation = .bottom, animated: Bool = false) -> [ScrollStackRow] { enumerateItems(views, insertAt: location) { addRow(view: $0, at: location, animated: animated)