Added public to extensions to make them visible to other packages.
This commit is contained in:
parent
a16a62b365
commit
84dac2cb6c
|
@ -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)
|
||||||
|
|
|
@ -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]()
|
||||||
|
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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()!
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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)])
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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))
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue