Skip to content

Commit

Permalink
Update SPM example project with SwiftUI interface
Browse files Browse the repository at this point in the history
  • Loading branch information
vtourraine committed Jan 9, 2024
1 parent aa992c2 commit 40a0366
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -18,25 +18,34 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="t09-Si-fxa">
<rect key="frame" x="112" y="418" width="191" height="30"/>
<rect key="frame" x="111.5" y="390" width="191" height="30"/>
<state key="normal" title="Present Acknowledgements"/>
<connections>
<action selector="presentAcknowledgements:" destination="BYZ-38-t0r" eventType="touchUpInside" id="QCw-84-8p7"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7sT-Lf-szL">
<rect key="frame" x="146" y="468" width="123" height="30"/>
<rect key="frame" x="145.5" y="440" width="123" height="30"/>
<state key="normal" title="Present Packages"/>
<connections>
<action selector="presentPackageAcknowledgements:" destination="BYZ-38-t0r" eventType="touchUpInside" id="krd-Cm-GrO"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PGn-A8-9NI">
<rect key="frame" x="79.5" y="490" width="255" height="30"/>
<state key="normal" title="Present Acknowledgements (SwiftUI)"/>
<connections>
<action selector="presentAcknowledgementsSwiftUI:" destination="BYZ-38-t0r" eventType="touchUpInside" id="s16-jf-2YC"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="t09-Si-fxa" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" constant="-20" id="Yfm-Jq-5xK"/>
<constraint firstItem="PGn-A8-9NI" firstAttribute="top" secondItem="7sT-Lf-szL" secondAttribute="bottom" constant="20" id="7vD-hZ-hRD"/>
<constraint firstItem="PGn-A8-9NI" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="YE6-u4-q40"/>
<constraint firstItem="7sT-Lf-szL" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="bKQ-a5-fxN"/>
<constraint firstItem="7sT-Lf-szL" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" id="fFv-fa-v3s"/>
<constraint firstItem="t09-Si-fxa" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="tyo-SQ-5Bf"/>
<constraint firstItem="7sT-Lf-szL" firstAttribute="top" secondItem="t09-Si-fxa" secondAttribute="bottom" constant="20" id="uuE-eh-Bor"/>
</constraints>
Expand Down
12 changes: 12 additions & 0 deletions Examples/AcknowExampleSPM/AcknowExampleSPM/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import UIKit
import SwiftUI
import AcknowList

class ViewController: UIViewController {
Expand All @@ -31,5 +32,16 @@ class ViewController: UIViewController {
let navigationController = UINavigationController(rootViewController: vc)
present(navigationController, animated: true, completion: nil)
}

@IBAction func presentAcknowledgementsSwiftUI(_ sender: AnyObject) {
let listViewController = AcknowListSwiftUIView(acknowledgements: [
Acknow(title: "Test", text: "Bla bla"),
Acknow(title: "Test URL", repository: URL(string: "https://developer.apple.com")),
Acknow(title: "Test GitHub", repository: URL(string: "https://github.com/vtourraine/AcknowList.git"))
])
let viewController = UIHostingController(rootView: listViewController)
let navigationController = UINavigationController(rootViewController: viewController)
present(navigationController, animated: true, completion: nil)
}
}

0 comments on commit 40a0366

Please sign in to comment.