Skip to content

Commit

Permalink
🆕 Add: Import Code to ios/src_library/Temp
Browse files Browse the repository at this point in the history
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
dominicstop committed Mar 28, 2023
1 parent 09bb6eb commit 3c6ac35
Show file tree
Hide file tree
Showing 38 changed files with 2,774 additions and 0 deletions.
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;
}
};
};
56 changes: 56 additions & 0 deletions ios/src_library/Temp/Extensions+Init/UIImage+Init.swift
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;
};
};
};
39 changes: 39 additions & 0 deletions ios/src_library/Temp/Extensions/Encodable+Helpers.swift
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);
};
};
Loading

0 comments on commit 3c6ac35

Please sign in to comment.