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
import UIKit | |
#if canImport(Combine) | |
import Combine | |
@available(iOS 13.0, *) | |
final class ActionPublished: UIAction { | |
convenience init(actionSubject: InFailablePassThroughSubject<Void>?) { | |
self.init { [weak actionSubject] _ in | |
actionSubject?.send(()) |
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
import UIKit | |
final class SceneManager { | |
var activityIdentifier: ActivityIdentifier? { | |
options | |
.userActivities | |
.compactMap { ActivityIdentifier(rawValue: $0.activityType) } | |
.first | |
} |
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
struct ContentView: View { | |
@State var isExpanded = false | |
@State var subviewHeight : CGFloat = 0 | |
var body: some View { | |
VStack { | |
Text("Headline") | |
VStack { | |
Text("More Info") |
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
import UIKit | |
extension UITapGestureRecognizer { | |
func didTapAttributedTextInLabel(label: UILabel, inRange targetRange: NSRange) -> Bool { | |
// Create instances of NSLayoutManager, NSTextContainer and NSTextStorage | |
let layoutManager = NSLayoutManager() | |
let textContainer = NSTextContainer(size: CGSize.zero) | |
let textStorage = NSTextStorage(attributedString: label.attributedText!) | |
// Configure layoutManager and textStorage |
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
from cv2 import resize, INTER_LINEAR | |
from multiprocessing import Pool | |
def compare(args): | |
img, img2 = args | |
img = (img - img.mean()) / img.std() | |
img2 = (img2 - img2.mean()) / img2.std() | |
return np.mean(np.abs(img - img2)) | |
class EpsilonPredictor: |
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
struct ContentView: View { | |
@State var isExpanded = false | |
@State var subviewHeight : CGFloat = 0 | |
var body: some View { | |
VStack { | |
Text("Headline") | |
VStack { | |
Text("More Info") |
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
import UIKit | |
public struct CocoStringAttributeHolder { | |
internal let key: NSAttributedString.Key | |
internal let value: Any | |
internal let range: Range<String.Index>? | |
fileprivate init(key: NSAttributedString.Key, value: Any, range: Range<String.Index>?) { | |
self.key = key |
NewerOlder