Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add project.yml for xcodegened project with SPM #1713

Merged
merged 2 commits into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Generated
Ruuvi Station.xcodeproj

# Private
station/Resources/Plists/GoogleService-Info.plist
station/Classes/Networking/Assembly/Networking.plist
Expand Down
7 changes: 0 additions & 7 deletions Common/RuuviBundleUtils/.gitignore

This file was deleted.

28 changes: 0 additions & 28 deletions Common/RuuviBundleUtils/Package.swift

This file was deleted.

3 changes: 0 additions & 3 deletions Common/RuuviBundleUtils/README.md

This file was deleted.

31 changes: 0 additions & 31 deletions Common/RuuviBundleUtils/RuuviBundleUtils.podspec

This file was deleted.

This file was deleted.

3 changes: 2 additions & 1 deletion Common/RuuviLocalization/Package.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// swift-tools-version:5.3
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "RuuviLocalization",
platforms: [.macOS(.v10_15), .iOS(.v13)],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably set minimum target to iOS 14 since the main target is already bumped to iOS 14 min.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that main target is iOS 14+, but we don't need it in these packages :) Imho let's keep the iOS 13 for now, will bump it if there is a need

products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
Expand Down
20 changes: 9 additions & 11 deletions Common/RuuviPresenters/Package.swift
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
// swift-tools-version:5.3
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "RuuviPresenters",
defaultLocalization: "en",
platforms: [.macOS(.v10_15), .iOS(.v13)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "RuuviPresenters",
targets: ["RuuviPresenters"])
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
targets: ["RuuviPresenters"]
)
],
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 this package depends on.
.target(
name: "RuuviPresenters",
dependencies: []),
resources: [.process("Resources")]
),
.testTarget(
name: "RuuviPresentersTests",
dependencies: ["RuuviPresenters"])
dependencies: ["RuuviPresenters"]
)
]
)
2 changes: 0 additions & 2 deletions Common/RuuviPresenters/RuuviPresenters.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ Pod::Spec.new do |s|
ss.resource_bundles = {
'RuuviPresenters' => ['Sources/**/Resources/**/*']
}

ss.dependency 'RuuviBundleUtils'
end

s.test_spec 'Tests' do |test_spec|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import UIKit
import RuuviBundleUtils

public final class ActivityPresenterRuuviLogo: ActivityPresenter {
var counter = 0 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import UIKit
import RuuviBundleUtils

public final class ErrorPresenterAlert: ErrorPresenter {
public init() {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import UIKit
import RuuviBundleUtils

public final class PermissionPresenterAlert: PermissionPresenter {
public init() {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="cCV-5c-TDN">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="cCV-5c-TDN">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Activity Ruuvi Logo View Controller-->
<scene sceneID="vIS-1l-jmn">
<objects>
<viewController storyboardIdentifier="ActivityRuuviLogoViewController" id="cCV-5c-TDN" customClass="ActivityRuuviLogoViewController" customModule="RuuviPresenters" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="ActivityRuuviLogoViewController" id="cCV-5c-TDN" customClass="ActivityRuuviLogoViewController" customModule="RuuviPresenters" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="BRY-66-QUu">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import XCTest
@testable import RuuviPresenters
@testable import RuuviPresenters

final class RuuviPresentersTests: XCTestCase {
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
XCTAssertEqual(RuuviPresenters().text, "Hello, World!")
}
final class RuuviPresentersTests: XCTestCase {
func testExample() {
}
}
35 changes: 26 additions & 9 deletions Modules/RuuviDiscover/Package.swift
Original file line number Diff line number Diff line change
@@ -1,28 +1,45 @@
// swift-tools-version:5.3
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "RuuviDiscover",
defaultLocalization: "en",
platforms: [.macOS(.v10_15), .iOS(.v13)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "RuuviDiscover",
targets: ["RuuviDiscover"])
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(path: "../../Packages/RuuviOntology"),
.package(path: "../../Packages/RuuviContext"),
.package(path: "../../Packages/RuuviReactor"),
.package(path: "../../Packages/RuuviLocal"),
.package(path: "../../Packages/RuuviService"),
.package(path: "../../Packages/RuuviVirtual"),
.package(path: "../../Common/RuuviPresenters"),
.package(path: "../../Common/RuuviLocalization"),
.package(url: "https://github.com/ruuvi/BTKit", .upToNextMinor(from: "0.4.3")),
],
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 this package depends on.
.target(
name: "RuuviDiscover",
dependencies: []),
dependencies: [
"RuuviOntology",
"RuuviContext",
"RuuviReactor",
"RuuviLocal",
"RuuviService",
"RuuviVirtual",
"RuuviPresenters",
"BTKit",
"RuuviLocalization"
]
),
.testTarget(
name: "RuuviDiscoverTests",
dependencies: ["RuuviDiscover"])
name: "RuuviDiscoverTests"
)
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import Foundation
import UIKit

extension Bundle {
public static func pod(_ clazz: AnyClass) -> Bundle {
if let module = NSStringFromClass(clazz).components(separatedBy: ".").first,
let bundleURL = Bundle(for: clazz).resourceURL?.appendingPathComponent("\(module).bundle"),
let bundle = Bundle(url: bundleURL) {
return bundle
} else {
assertionFailure()
return Bundle.main
}
}
}

extension UIImage {
public static func named(_ name: String, for clazz: AnyClass) -> UIImage? {
#if SWIFT_PACKAGE
return UIImage(named: name, in: Bundle.module, compatibleWith: nil)
#else
return UIImage(named: name, in: Bundle.pod(clazz), compatibleWith: nil)
#endif
}
}

extension String {
public func localized(for clazz: AnyClass) -> String {
let bundle: Bundle
#if SWIFT_PACKAGE
bundle = Bundle.module
#else
bundle = Bundle.pod(clazz)
#endif
if let module = NSStringFromClass(clazz).components(separatedBy: ".").first {
if let path = bundle.path(forResource: currentLanguage(), ofType: "lproj"),
let bundle = Bundle(path: path) {
return bundle.localizedString(forKey: self, value: nil, table: module)
} else if let path = bundle.path(forResource: "Base", ofType: "lproj"),
let bundle = Bundle(path: path) {
return bundle.localizedString(forKey: self, value: nil, table: module)
} else {
assertionFailure()
return self
}
} else {
assertionFailure()
return self
}
}

private func currentLanguage() -> String {
if let preferred = Bundle.main.preferredLocalizations.first {
return preferred
} else {
return "Base"
}
}
}

extension UIStoryboard {
public static func named(_ name: String, for clazz: AnyClass) -> UIStoryboard {
let bundle: Bundle
#if SWIFT_PACKAGE
bundle = Bundle.module
#else
bundle = Bundle.pod(clazz)
#endif
return UIStoryboard(name: name, bundle: bundle)
}
}

extension UINib {
public static func nibName(_ nibName: String, for clazz: AnyClass) -> UINib {
let bundle: Bundle
#if SWIFT_PACKAGE
bundle = Bundle.module
#else
bundle = Bundle.pod(clazz)
#endif
return UINib(nibName: nibName, bundle: bundle)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import BTKit
import RuuviOntology
import RuuviVirtual
import RuuviLocalization
import RuuviBundleUtils
import CoreNFC

enum DiscoverTableSection {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import XCTest
@testable import RuuviDiscover

final class RuuviDiscoverTests: XCTestCase {
func testExample() {
Expand Down
Loading