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 Combine | |
| import SwiftUI | |
| struct ContentView: View { | |
| @State var text = "" | |
| @State var keyboardObserver = KeyboardObserver() | |
| @Namespace var union | |
| var body: some View { | |
| VStack { |
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 SwiftUI | |
| struct ContentView: View { | |
| let handleSize = 40.0 | |
| @State private var x = 0.0 | |
| @State private var xOffset = 0.0 | |
| @State private var sliderWidth = 0.0 | |
| @State private var previousInterpolatedX = 0.0 | |
| private var sliderMidPoint: Double { | |
| (self.sliderWidth - self.handleSize) / 2 |
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 PhotosUI | |
| import SwiftUI | |
| class ImageModel: ObservableObject { | |
| enum ImageState { | |
| case empty, loading(Progress), success(Image), failure(Error) | |
| } | |
| @Published private(set) var imageState: ImageState = .empty | |
| @Published var imageSelection: PhotosPickerItem? { |
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
| const data = [ | |
| { | |
| latitude: 33.17391333333333, | |
| longitude: -96.67814, | |
| }, | |
| { | |
| latitude: 33.173925, | |
| longitude: -96.678435, | |
| }, | |
| { |
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 React from 'react'; | |
| import { StyleSheet, View, Text, SafeAreaView, Animated, TouchableWithoutFeedback } from 'react-native'; | |
| import { PanGestureHandler } from 'react-native-gesture-handler'; | |
| export default class AppContainer extends React.Component { | |
| horizontalSliderXAnimVal = new Animated.Value(0); | |
| _touchX = new Animated.Value(0); | |
| _onPanGestureEvent = Animated.event([{ nativeEvent: { x: this._touchX } }], { useNativeDriver: true }); | |
| render() { | |
| return ( |
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
| on replaceText(find, replace, subject) | |
| set prevTIDs to text item delimiters of AppleScript | |
| set text item delimiters of AppleScript to find | |
| set subject to text items of subject | |
| set text item delimiters of AppleScript to replace | |
| set subject to subject as text | |
| set text item delimiters of AppleScript to prevTIDs | |
| return subject |
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 Animated from "react-native-reanimated"; | |
| const { add, sub, abs } = Animated; | |
| this.xyVal = add( | |
| abs(sub(props.left + TILE_WIDTH / 2 - width / 2, props.x)), | |
| abs(sub(props.top + TILE_HEIGHT / 2 - height / 2, props.y)) | |
| ); |