hell nah fuck this

This commit is contained in:
neon443
2025-06-14 18:27:13 +01:00
parent 2dd2c51059
commit 22af9fc060
2 changed files with 26 additions and 11 deletions

View File

@@ -9,16 +9,16 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--Symbols Picker Storyboard--> <!--View Controller-->
<scene sceneID="s0d-6b-0kx"> <scene sceneID="s0d-6b-0kx">
<objects> <objects>
<viewController storyboardIdentifier="SymbolsPicker" id="Y6W-OH-hqX" customClass="SymbolsPickerStoryboard" sceneMemberID="viewController"> <viewController storyboardIdentifier="ViewController" id="Y6W-OH-hqX" customClass="ViewController" customModule="NearFuture" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc"> <view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/> <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="xBf-3w-4Ao"> <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="xBf-3w-4Ao">
<rect key="frame" x="0.0" y="118" width="393" height="666"/> <rect key="frame" x="0.0" y="63" width="393" height="666"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<collectionViewFlowLayout key="collectionViewLayout" automaticEstimatedItemSize="YES" minimumLineSpacing="10" minimumInteritemSpacing="10" id="d2N-B5-D5N"> <collectionViewFlowLayout key="collectionViewLayout" automaticEstimatedItemSize="YES" minimumLineSpacing="10" minimumInteritemSpacing="10" id="d2N-B5-D5N">
@@ -28,15 +28,15 @@
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout> </collectionViewFlowLayout>
<cells> <cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="nKx-2O-Nq5" customClass="SymbolCell" customModule="NearFuture" customModuleProvider="target"> <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="symbolCell" id="nKx-2O-Nq5" customClass="SymbolCell" customModule="NearFuture" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="100" height="100"/> <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="3DG-aV-ZH4"> <collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="3DG-aV-ZH4">
<rect key="frame" x="0.0" y="0.0" width="100" height="100"/> <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AaY-Po-OoS"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AaY-Po-OoS">
<rect key="frame" x="0.0" y="0.0" width="100" height="84"/> <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gGM-kQ-cA7"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gGM-kQ-cA7">

View File

@@ -27,6 +27,12 @@ class ViewController: UIViewController {
) )
} }
} }
override func viewDidLoad() {
super.viewDidLoad()
collectionView.delegate = self
collectionView.dataSource = self
}
} }
extension ViewController: UICollectionViewDataSource { extension ViewController: UICollectionViewDataSource {
@@ -38,14 +44,14 @@ extension ViewController: UICollectionViewDataSource {
_ collectionView: UICollectionView, _ collectionView: UICollectionView,
numberOfItemsInSection section: Int numberOfItemsInSection section: Int
) -> Int { ) -> Int {
10 section
} }
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! SymbolCell let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "symbolCell", for: indexPath) as! SymbolCell
let imageView = cell.imageView let imageView = cell.imageView
imageView?.image = UIImage(systemName: symbolLoader.allSymbols[indexPath.item]) imageView?.image = UIImage(systemName: symbolLoader.allSymbols[indexPath.item])!
cell.textLabel?.text = "hi\(indexPath.row)" cell.textLabel?.text = "hi\(indexPath.row)"
return cell return cell
} }
@@ -53,7 +59,7 @@ extension ViewController: UICollectionViewDataSource {
extension ViewController: UICollectionViewDelegate { extension ViewController: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
print(indexPath.item + 1) print(indexPath.item)
} }
} }
@@ -64,9 +70,18 @@ class SymbolCell: UICollectionViewCell {
} }
struct SymbolsPickerStoryboardUIViewRepresentable: UIViewRepresentable { struct SymbolsPickerStoryboardUIViewRepresentable: UIViewRepresentable {
class Coordinator {
var viewController: ViewController?
}
func makeCoordinator() -> Coordinator {
Coordinator()
}
func makeUIView(context: Context) -> some UIView { func makeUIView(context: Context) -> some UIView {
let storyboard = UIStoryboard(name: "SymbolsPicker", bundle: nil) let storyboard = UIStoryboard(name: "SymbolsPicker", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "SymbolsPicker") as! ViewController let viewController = storyboard.instantiateViewController(withIdentifier: "ViewController") as! ViewController
context.coordinator.viewController = viewController
return viewController.view return viewController.view
} }