-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🆕 Add: Import Code to
ios/src_library/Temp
Related: * `TODO:2023-03-28-18-52-17` - Pre-migration to `react-native-ios-utilites`. * `TODO:2023-03-29-04-34-35` - Copy over `react-native-ios-utilities` native source to `ios/src_library/Temp`. empty
- Loading branch information
1 parent
09bb6eb
commit 3c6ac35
Showing
38 changed files
with
2,774 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
ios/src_library/Temp/Extensions+Init/CAGradientLayerType+Init.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// CAGradientLayerType+Init.swift | ||
// react-native-ios-navigator | ||
// | ||
// Created by Dominic Go on 4/12/21. | ||
// | ||
|
||
import Foundation | ||
|
||
public extension CAGradientLayerType { | ||
init?(string: String){ | ||
switch string { | ||
case "axial" : self = .axial; | ||
case "radial": self = .radial; | ||
|
||
case "conic" : | ||
if #available(iOS 12.0, *) { | ||
self = .conic; | ||
|
||
} else { | ||
return nil; | ||
}; | ||
|
||
default: return nil; | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// UIImage+Init.swift | ||
// react-native-ios-navigator | ||
// | ||
// Created by Dominic Go on 10/2/21. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
public extension UIImage.RenderingMode { | ||
init?(string: String){ | ||
switch string { | ||
case "automatic" : self = .automatic; | ||
case "alwaysOriginal": self = .alwaysOriginal; | ||
case "alwaysTemplate": self = .alwaysTemplate; | ||
|
||
default: return nil; | ||
}; | ||
}; | ||
}; | ||
|
||
@available(iOS 13.0, *) | ||
public extension UIImage.SymbolWeight { | ||
init?(string: String){ | ||
switch string { | ||
case "unspecified": self = .unspecified; | ||
case "ultraLight" : self = .ultraLight; | ||
case "thin" : self = .thin; | ||
case "light" : self = .light; | ||
case "regular" : self = .regular; | ||
case "medium" : self = .medium; | ||
case "semibold" : self = .semibold; | ||
case "bold" : self = .bold; | ||
case "heavy" : self = .heavy; | ||
case "black" : self = .black; | ||
|
||
default: return nil; | ||
}; | ||
}; | ||
}; | ||
|
||
@available(iOS 13.0, *) | ||
public extension UIImage.SymbolScale { | ||
init?(string: String){ | ||
switch string { | ||
case "default" : self = .`default`; | ||
case "unspecified" : self = .unspecified; | ||
case "small" : self = .small; | ||
case "medium" : self = .medium; | ||
case "large" : self = .large; | ||
|
||
default: return nil; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// Encodable+Helpers.swift | ||
// nativeUIModulesTest | ||
// | ||
// Created by Dominic Go on 7/6/20. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct JSON { | ||
static let encoder = JSONEncoder(); | ||
}; | ||
|
||
public extension Encodable { | ||
subscript(key: String) -> Any? { | ||
return dictionary[key]; | ||
}; | ||
|
||
var dictionary: [String: Any] { | ||
return | ||
(try? JSONSerialization.jsonObject(with: JSON.encoder.encode(self))) | ||
as? [String: Any] ?? [:]; | ||
}; | ||
|
||
func jsonData() throws -> Data { | ||
let encoder = JSON.encoder; | ||
|
||
encoder.outputFormatting = .prettyPrinted; | ||
|
||
if #available(iOS 10.0, *) { | ||
encoder.dateEncodingStrategy = .iso8601; | ||
|
||
} else { | ||
encoder.dateEncodingStrategy = .millisecondsSince1970; | ||
}; | ||
|
||
return try encoder.encode(self); | ||
}; | ||
}; |
Oops, something went wrong.