Added public to extensions to make them visible to other packages.

This commit is contained in:
Robert McGovern 2021-07-06 01:59:50 +01:00
parent a16a62b365
commit 84dac2cb6c
12 changed files with 12 additions and 12 deletions

View File

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
extension AnyTransition { public extension AnyTransition {
static var scaleAndFade: AnyTransition { static var scaleAndFade: AnyTransition {
let insertion = AnyTransition.scale let insertion = AnyTransition.scale
.combined(with: .opacity) .combined(with: .opacity)

View File

@ -12,7 +12,7 @@ import Foundation
provides two methods: one called removingDuplicates() that returns an array with duplicates removed, and one called removeDuplicates() that changes the array in place. provides two methods: one called removingDuplicates() that returns an array with duplicates removed, and one called removeDuplicates() that changes the array in place.
*/ */
extension Array where Element: Hashable { public extension Array where Element: Hashable {
func removingDuplicates() -> [Element] { func removingDuplicates() -> [Element] {
var addedDict = [Element: Bool]() var addedDict = [Element: Bool]()

View File

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
extension Binding { public extension Binding {
func didSet(execute: @escaping (Value) -> Void) -> Binding { func didSet(execute: @escaping (Value) -> Void) -> Binding {
return Binding( return Binding(
get: { get: {

View File

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
extension Color { public extension Color {
func toString() -> String { func toString() -> String {
let uiColor = UIColor(self) let uiColor = UIColor(self)
var red: CGFloat = 0 var red: CGFloat = 0

View File

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
extension Color { public extension Color {
static var random: Color { static var random: Color {
[Color.red, Color.orange, Color.yellow, Color.blue, Color.purple, Color.pink, Color.green].randomElement()! [Color.red, Color.orange, Color.yellow, Color.blue, Color.purple, Color.pink, Color.green].randomElement()!
} }

View File

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
class Directories { public class Directories {
// Get user's documents directory path // Get user's documents directory path
static func getDocumentsDirectoryPath() -> URL { static func getDocumentsDirectoryPath() -> URL {

View File

@ -7,7 +7,7 @@
import Foundation import Foundation
extension String { public extension String {
subscript(idx: Int) -> String { subscript(idx: Int) -> String {
String(self[index(startIndex, offsetBy: idx)]) String(self[index(startIndex, offsetBy: idx)])
} }

View File

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
extension UIHostingController { public extension UIHostingController {
func capture(transparentBackground: Bool = true) -> UIImage { func capture(transparentBackground: Bool = true) -> UIImage {
let size = sizeThatFits(in: UIScreen.main.bounds.size) let size = sizeThatFits(in: UIScreen.main.bounds.size)

View File

@ -7,7 +7,7 @@
import UIKit import UIKit
extension UIImage { public extension UIImage {
func resizeImage(newWidth: CGFloat) -> UIImage? { func resizeImage(newWidth: CGFloat) -> UIImage? {
let scale = newWidth / self.size.width let scale = newWidth / self.size.width

View File

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
extension View { public extension View {
func glow(color: Color = .red, radius: CGFloat = 20) -> some View { func glow(color: Color = .red, radius: CGFloat = 20) -> some View {
self self
.overlay(self.blur(radius: radius / 6)) .overlay(self.blur(radius: radius / 6))

View File

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
extension View { public extension View {
func hideKeyboard() { func hideKeyboard() {
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
} }

View File

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
extension View { public extension View {
func multicolorGlow() -> some View { func multicolorGlow() -> some View {
ForEach(0..<2) { i in ForEach(0..<2) { i in
Rectangle() Rectangle()