Skip to content

Добавлена поддержка SPM #5

Merged
merged 2 commits into from
Jan 25, 2021
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
2 changes: 1 addition & 1 deletion Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb
TinkoffID: 67a2c6dac8becf1417311a003814b73d39b2a567
TinkoffID: ac03552becea632de0f13d9461621770444ae0b8

PODFILE CHECKSUM: d1e73e199c553c711c8552e3d915b504119d4beb

Expand Down
28 changes: 28 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "TinkoffID",
defaultLocalization: "ru",
platforms: [.iOS(.v10)],
products: [
.library(
name: "TinkoffID",
targets: ["TinkoffID"]
),
],
targets: [
.target(
name: "TinkoffID",
dependencies: [],
path: "Sources"
),
.testTarget(
name: "TinkoffIDTests",
dependencies: ["TinkoffID"],
path: "Tests"
),
]
)
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@

## Установка

TinkoffID доступен через [CocoaPods](https://cocoapods.org). Для установки просто добавьте следующую строчку в ваш `Podfile`:
### Swift Package Manager
`TinkoffID` поддерживает Swift Package Manager. Инструкцию по настройке SPM для вашего проекта можно найти [здесь](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app).
После настройки проекта просто добавьте ссылку на репозиторий как зависимость:

```
https://github.com/tinkoff-mobile-tech/TinkoffID-iOS
```

### Cocoapods
Для установки `TinkoffID` с помощью [CocoaPods](https://cocoapods.org) необходимо добавить следующую строчку в ваш `Podfile`:

```ruby
pod 'TinkoffID'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import UIKit

/// Роутер URL
protocol IURLRouter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
//

import Foundation
import UIKit

extension Bundle {
static var resourcesBundle: Bundle? {
let bundle = Bundle(for: TinkoffIDButton.self)

guard let resourcesBundleUrl = bundle.resourceURL?.appendingPathComponent("TinkoffIdResources.bundle") else {
return nil
}

return Bundle(url: resourcesBundleUrl)
#if SWIFT_PACKAGE
return Bundle.module
#else
return Bundle(for: TinkoffIDButton.self)
.resourceURL
.flatMap(Bundle.init(url:))
#endif
}

func imageNamed(_ name: String) -> UIImage? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import UIKit

public final class TinkoffIDBuilder {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Dmitry on 17.12.2020.
//

import Foundation
import UIKit

final class TinkoffIDButton: UIButton {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Dmitry on 18.12.2020.
//

import Foundation
import UIKit

/// Стиль кнопки входа
public enum TinkoffIDButtonStyle {
Expand Down
6 changes: 2 additions & 4 deletions TinkoffID.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/tinkoff-mobile-tech/TinkoffID.git', :tag => s.version.to_s }
s.ios.deployment_target = '10.0'
s.swift_version = '5.0'
s.source_files = 'Development/Source/**/*'
s.resource_bundles = {
'TinkoffIdResources' => ['Development/Resources/**/*.{strings,xcassets}']
}
s.source_files = 'Sources/**/*.swift'
s.resources = 'Sources/**/*.{xcassets,lproj}'
Copy link

Choose a reason for hiding this comment

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

а почему он бандла отказался? Так же правильнее, чтобы сделать уникальное имя и ресурсы не терялись

Copy link
Contributor Author

@ovrchk ovrchk Jan 25, 2021

Choose a reason for hiding this comment

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

ну, технически, ресурсный бандл все равно создается (для бандла TinkoffID), смысла нет указывать явный бандл если нам не требуется разделение на несколько ресурсных бандлов и загрузка их по-отдельности


s.test_spec 'Tests' do |test_spec|
test_spec.source_files = 'Tests/**/*.{swift}'
Expand Down