Skip to content

Commit

Permalink
Merge branch 'master' into IDPT-715-add-baselineoffset
Browse files Browse the repository at this point in the history
  • Loading branch information
gregoryvit authored Apr 12, 2021
2 parents 54dccc8 + 9ae32d5 commit aafea02
Show file tree
Hide file tree
Showing 18 changed files with 117 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Utils/fastlane/Provisioning
Utils/fastlane/Build
Utils/fastlane/report.xml
Utils/buildData
.swiftpm
.DS_Store

# Bundler
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
- cd Utils
- make init
- xcodebuild test -scheme Utils -workspace Utils.xcworkspace/ -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO -enableCodeCoverage YES -destination 'platform=iOS Simulator,name=iPhone 8,OS=12.2' | xcpretty -c
- swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios12.1-simulator" -Xswiftc "-lswiftUIKit"
- stage: Pod Lib Lint
name: Pod Lib Lint
script:
Expand Down
25 changes: 25 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"object": {
"pins": [
{
"package": "CryptoSwift",
"repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift",
"state": {
"branch": null,
"revision": "39f08ac5269361a50c08ce1e2f41989bfc4b1ec8",
"version": "1.3.1"
}
},
{
"package": "Device",
"repositoryURL": "https://github.com/Alelenka/Device",
"state": {
"branch": "spm-support",
"revision": "df290adc142a10ef73a9b62e9f03e54d1f2f62ee",
"version": null
}
}
]
},
"version": 1
}
44 changes: 44 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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: "Utils",
platforms: [.iOS(.v11)],
products: [
.library(
name: "Utils",
targets: ["Utils"]),
],
dependencies: [
.package(
name: "CryptoSwift",
url: "https://github.com/krzyzanowskim/CryptoSwift",
.exact("1.3.1")
),
.package(
name: "Device",
url: "https://github.com/Alelenka/Device",
.branch("spm-support")
),
],
targets: [
.target(
name: "Utils",
dependencies: ["CryptoSwift", "Device"],
path: "Utils/Utils",
exclude: [
"Info.plist"
]
),
.testTarget(
name: "UtilsTests",
dependencies: ["Utils"],
path: "Utils/UtilsTests",
exclude: [
"Info.plist"
]
)
]
)
5 changes: 5 additions & 0 deletions Utils/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
1 change: 1 addition & 0 deletions Utils/Utils/BrightSide/BrightSide.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import UIKit

public final class BrightSide {

Expand Down
1 change: 1 addition & 0 deletions Utils/Utils/LoadingView/LoadingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import UIKit

public protocol LoadingView: UIView {
func setNeedAnimating(_ needAnimating: Bool)
Expand Down
3 changes: 3 additions & 0 deletions Utils/Utils/LocalStorage/LocalStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// Copyright © 2019 Surf. All rights reserved.
//

import Foundation
import UIKit

/// Local storage based on filemanager uses cache directory
final public class LocalStorage {

Expand Down
2 changes: 2 additions & 0 deletions Utils/Utils/OTPField/DigitFieldStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2019 Surf. All rights reserved.
//

import UIKit

public struct DigitFieldStyle {
public let font: UIFont
public let activeTextColor: UIColor
Expand Down
2 changes: 2 additions & 0 deletions Utils/Utils/OTPField/OTPFieldStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2019 Surf. All rights reserved.
//

import UIKit

public struct OTPFieldStyle {
public let digitStyle: DigitFieldStyle
public let errorTextColor: UIColor
Expand Down
1 change: 1 addition & 0 deletions Utils/Utils/SettingsRouter/SettingsRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import UIKit

/// Utils for opening various settings screens from the application
public final class SettingsRouter {
Expand Down
1 change: 1 addition & 0 deletions Utils/Utils/UIDevice/UIDevice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Device
import UIKit

public extension UIDevice {

Expand Down
1 change: 1 addition & 0 deletions Utils/Utils/UIImage/UIImage+badgedImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import UIKit

public extension UIImage {

Expand Down
26 changes: 20 additions & 6 deletions Utils/Utils/UIView/UIView+XibSetup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
import UIKit

public extension UIView {
func xibSetup() {
let view = loadFromNib()
func xibSetup(bundle: Bundle) {
let view = loadFromNib(bundle: bundle)
addSubview(view)
stretch(view: view)
}

func loadFromNib<T: UIView>() -> T {
func loadFromNib<T: UIView>(bundle: Bundle) -> T {
let selfType = type(of: self)
let bundle = Bundle(for: selfType)
let nibName = String(describing: selfType)
let nib = UINib(nibName: nibName, bundle: bundle)

Expand All @@ -28,8 +27,7 @@ public extension UIView {
return view
}

static func loadFromNib<T: UIView>() -> T {
let bundle = Bundle(for: self)
static func loadFromNib<T: UIView>(bundle: Bundle) -> T {
let nibName = String(describing: self)
let nib = UINib(nibName: nibName, bundle: bundle)

Expand All @@ -40,6 +38,22 @@ public extension UIView {
return view
}

func xibSetup() {
let view = loadFromNib()
addSubview(view)
stretch(view: view)
}

func loadFromNib<T: UIView>() -> T {
let bundle = Bundle(for: type(of: self))
return loadFromNib(bundle: bundle)
}

static func loadFromNib<T: UIView>() -> T {
let bundle = Bundle(for: self)
return loadFromNib(bundle: bundle)
}

func stretch(view: UIView) {
view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// Copyright © 2018 Surf. All rights reserved.
//

import Foundation
import UIKit

extension UIDevice {
enum FeedbackType: Int {
case base = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2018 Surf. All rights reserved.
//

import UIKit

extension UIDevice {
// haptic feedback support guarantees that device supports taptic engine too.
var hasHapticFeedback: Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2018 Surf. All rights reserved.
//

import UIKit

extension UIDevice {
var hasTapticEngine: Bool {
return feedbackType == .taptic || hasHapticFeedback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import AudioToolbox
import Foundation
import UIKit

/**
*
Expand Down

0 comments on commit aafea02

Please sign in to comment.