Skip to content

Commit

Permalink
Introduce Swift Package Manager Support (#99)
Browse files Browse the repository at this point in the history
* removed tv-os targets as a Swift Package is platform independent.

* added Package.swift

* minor update to Package.swift

* formatting

* added all targets under a sources folder

* added exclusion of info.plust

* cleaned up warnings, updated to recommended projects settings, ensured tests pass locally.

* removed exlude now that info plist is referenced correctly from within build settings.

* updated circle.yml to support newer versions of iOS and removed unused framework

* fixed linter issues

* fixed bin/test in circleci.yml to reflect new schema names

* made adjustments to schema naming to support test script.

* ci doesn't support same simulator versions as locally so updating accordingly.

* fixing import that is only an issue once the swift package is being built via SPM in another project.

* added target dependency for Prelude in PreludeUI-UIKit target

* corrected nesting of dependencies array in Package.swift

* explicitly set enable_testing_search_paths to true even though compiler should link xctest with the import xctest statement.

* added public access modifier to some UIKit Lens properties.

* added public access modifier to dictionary property.

* moved all test files into their own directory called Tests because they were inside Sources, which seems to run them when the app gets built. Also modified the Swift Package file to include a specific path to the tests.

* added missing test file to test target

* removed pre-existing test file from within directory folder.

* updated the package libraries to link dynamicly explicitly. Trying to fix a runtime crash on devices in Kickstarter-iOS.

* Revert "updated the package libraries to link dynamicly explicitly. Trying to fix a runtime crash on devices in Kickstarter-iOS."

This reverts commit c9be257.

* added iOS 15 navigation bar lens for appearance.

* updated deployment target to iOS 13 for Prelude_UIKit only (from 12.0)

* added availability tags to the new properties for iOS 13 navigation bar appearance.

* removed webview lenses, updated min deploy version to 14, cleaned up warnings.

* update ci

* addressing linter comments

* fixed some naming references to ReactiveExtensions

* Test Prelude and Prelude-UIKit updates in makefile and ci file.

* reference correction to ci file

* more reference corrections

* updated targets to use fewer targets, also set the min platform versions on the Package.swift file.
  • Loading branch information
msadoon authored May 2, 2023
1 parent a3dc54c commit f3a2dc4
Show file tree
Hide file tree
Showing 99 changed files with 531 additions and 1,352 deletions.
115 changes: 115 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
version: 2.1

xcode_version: &xcode_version 14.2.0
iphone_name: &iphone_name iPhone 14 Pro Max
preload_iphone_simulator: &preload_iphone_simulator xcrun instruments -w "iPhone 14 Pro Max (16.2) [" || true
ipad_name: &ipad_name iPad Air (5th generation)
preload_ipad_simulator: &preload_ipad_simulator xcrun instruments -w "iPad Air (5th generation) (16.2) [" || true

# Templates

iphone_default_environment: &iphone_default_environment
CIRCLE_ARTIFACTS: /tmp
BUNDLE_PATH: vendor/bundle
FL_OUTPUT_DIR: output
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
IPHONE_NAME: *iphone_name
XCODE_VERSION: *xcode_version
PLATFORM: iOS

ipad_default_environment: &ipad_default_environment
CIRCLE_ARTIFACTS: /tmp
BUNDLE_PATH: vendor/bundle
FL_OUTPUT_DIR: output
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
IPHONE_NAME: *ipad_name
XCODE_VERSION: *xcode_version
PLATFORM: iOS

base_job: &base_job
macos:
xcode: *xcode_version
working_directory: ~/Prelude

test_prelude_setup_job: &test_prelude_setup_job
steps:
- checkout
- run: HOMEBREW_NO_AUTO_UPDATE=1 brew install swiftlint
- run: set -o pipefail &&
swiftlint lint --strict --reporter json |
tee $CIRCLE_ARTIFACTS/swiftlint-report.json
- run:
name: Store Xcode Version
command: xcodebuild -version > xcode_version.txt
- run:
name: Pre-load iOS simulator
command: *preload_iphone_simulator
- run:
name: Run Prelude-iOS Tests
command: make test-prelude
no_output_timeout: "20m" # 20 minutes
- store_artifacts:
name: Swiftlint Artifacts
path: /tmp/swiftlint-report.json
- store_artifacts:
name: Xcode Artifacts
path: /tmp/xcode_raw.log

test_prelude_uikit_setup_job: &test_prelude_uikit_setup_job
steps:
- checkout
- run: HOMEBREW_NO_AUTO_UPDATE=1 brew install swiftlint
- run: set -o pipefail &&
swiftlint lint --strict --reporter json |
tee $CIRCLE_ARTIFACTS/swiftlint-report.json
- run:
name: Store Xcode Version
command: xcodebuild -version > xcode_version.txt
- run:
name: Pre-load iOS simulator
command: *preload_ipad_simulator
- run:
name: Run Prelude-UIKit-iOS Tests
command: make test-prelude-uikit
no_output_timeout: "20m" # 20 minutes
- store_artifacts:
name: Swiftlint Artifacts
path: /tmp/swiftlint-report.json
- store_artifacts:
name: Xcode Artifacts
path: /tmp/xcode_raw.log

# Jobs

jobs:
# Prelude-iOS tests
prelude-ios-tests:
<<: *base_job
<<: *test_prelude_setup_job
environment:
- *iphone_default_environment
- SCHEME=Prelude-iOS

# Prelude-UIKit-iOS tests
prelude-uikit-ios-tests:
<<: *base_job
<<: *test_prelude_uikit_setup_job
environment:
- *ipad_default_environment
- SCHEME=Prelude-UIKit-iOS

# Workflows
workflows:
version: 2
build:
jobs:
- prelude-ios-tests
- prelude-uikit-ios-tests

experimental:
notify:
branches:
only:
- master
1 change: 0 additions & 1 deletion Frameworks/Runes
Submodule Runes deleted from 30701f
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test-prelude:
xcodebuild test -scheme Prelude-iOS -destination platform='iOS Simulator',name='iPhone 14 Pro Max',OS=16.2
test-prelude-uikit:
xcodebuild test -scheme Prelude-UIKit-iOS -destination platform='iOS Simulator',name='iPad Air (5th generation)',OS=16.2
34 changes: 34 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// swift-tools-version:5.5
import PackageDescription

let package = Package(
name: "Prelude",
platforms: [
.iOS(.v14)
],
products: [
.library(
name: "Prelude",
targets: ["Prelude"]
),
.library(
name: "Prelude_UIKit",
targets: ["Prelude-UIKit"]
)
],
targets: [
.target(name: "Prelude"),
.testTarget(
name: "PreludeTests",
dependencies: ["Prelude"],
path: "Tests/PreludeTests"
),
.target(name: "Prelude-UIKit",
dependencies: ["Prelude"]),
.testTarget(
name: "Prelude-UIKitTests",
dependencies: ["Prelude-UIKit"],
path: "Tests/Prelude-UIKitTests"
)
]
)
38 changes: 0 additions & 38 deletions Prelude-UIKit/lenses/UIWebViewLenses.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,5 @@ p10.creator.location.name
* [Chris Eidhof - Lenses in Swift](http://chris.eidhof.nl/post/lenses-in-swift/)
* [A Little Lens Tutorial](https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/a-little-lens-starter-tutorial)
*/
// swiftlint:enable line_length
// swiftlint:enable type_name
1 change: 1 addition & 0 deletions Prelude.playground/Sources/playgroundController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,4 @@ public func playgroundControllers(device: Device = .phone4_7inch,

return (parent, child)
}
// swiftlint:enable function_body_length
2 changes: 1 addition & 1 deletion Prelude.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='6.0' target-platform='ios' display-mode='raw' executeOnSourceChanges='false' last-migration='0820'>
<playground version='6.0' target-platform='ios' display-mode='raw' last-migration='0820'>
<pages>
<page name='00-Introduction'/>
<page name='01-Array.swift'/>
Expand Down
Loading

0 comments on commit f3a2dc4

Please sign in to comment.