Reddit post, recreation of the animation.
This file contains hidden or 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
| struct MotionEffectModifier: ViewModifier { | |
| @ObservedObject private(set) var manager = MotionManager.shared | |
| @Binding var pitch: Double | |
| @Binding var roll: Double | |
| let magnitude: Double | |
| func body(content: Content) -> some View { | |
| content | |
| .onAppear { manager.startUpdate() } | |
| .onDisappear { manager.stopUpdate() } |
This file contains hidden or 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
| import Foundation | |
| @dynamicMemberLookup | |
| class NumberAbbreviationFormatter { | |
| // MARK: - Internal properties | |
| var formatter = NumberFormatter() | |
| // MARK: - Static configurations |
This file contains hidden or 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
| import Foundation | |
| public extension Task where Failure == Error { | |
| /// Performs an async task in a sync context. | |
| /// | |
| /// - Note: This function blocks the thread until the given operation is finished. The caller is responsible for managing multithreading. | |
| @discardableResult | |
| static func synchronous( | |
| priority: TaskPriority? = nil, | |
| @_implicitSelfCapture operation: @escaping @Sendable () async -> Success |
This file contains hidden or 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
| [ | |
| { | |
| "name": "Afghanistan", | |
| "dial_code": "+93", | |
| "code": "AF" | |
| }, | |
| { | |
| "name": "Albania", | |
| "dial_code": "+355", | |
| "code": "AL" |
This file contains hidden or 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
| # | |
| # Created by Seyed Mojtaba Hosseini Zeidabadi. | |
| # | |
| # StackOverflow: https://stackoverflow.com/story/mojtabahosseini | |
| # Linkedin: https://linkedin.com/in/MojtabaHosseini | |
| # GitHub: https://github.com/MojtabaHs | |
| # | |
| COLOR='\033[1;36m' | |
| NO_COLOR='\033[0m' |
This file contains hidden or 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
| // MARK: - Color Replacement | |
| extension UIImage { | |
| func image(byReplacing sourceColor: UIColor, with destinationColor: UIColor, minTolerance: Float, maxTolerance: Float) -> UIImage? { | |
| guard let inputCGImage = cgImage else { | |
| print("unable to get cgImage") | |
| return self | |
| } | |
| let colorSpace = CGColorSpaceCreateDeviceRGB() | |
| let width = inputCGImage.width | |
| let height = inputCGImage.height |
This file contains hidden or 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
| extension View { | |
| func flexible(width: Bool, height: Bool) -> some View { | |
| self.modifier(MatchingParentModifier(width: width, height: height)) | |
| } | |
| } | |
| struct MatchingParentModifier: ViewModifier { | |
| @State private var intrinsicSize: CGSize = UIScreen.main.bounds.size | |
| private let intrinsicWidth: Bool | |
| private let intrinsicHeight: Bool |
Since iOS 12, the system can read the one-time password from the received SMS automatically and add it above the keyboard, So users can use the code with only one touch. There are rules and limitations for doing this as I tried to list most of them below:
- The message must contain the Code prase. Some other words like passcode and password are ok too in English.
- The Code phrase (with or without
:) must be separate with only one space with your numbers.
example:
Code 1111111
Code: 111111
This file contains hidden or 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
| switch identifier { | |
| // MARK: - iPhone Identifiers | |
| case "iPhone1,1": return "iPhone" | |
| case "iPhone1,2": return "iPhone 3G" | |
| case "iPhone2,1": return "iPhone 3GS" | |
| case "iPhone3,1": return "iPhone 4" | |
| case "iPhone3,2": return "iPhone 4 GSM Rev A" | |
| case "iPhone3,3": return "iPhone 4 CDMA" | |
| case "iPhone4,1": return "iPhone 4S" |
NewerOlder
