swift4
- 通常のボタンタップとロングプレスを判定する
import UIKit
class ViewController: UIViewController {| import Foundation | |
| import HealthKit | |
| struct WorkoutSplit: Hashable { | |
| let label: String | |
| let distance: HKQuantity | |
| let duration: TimeInterval | |
| } | |
| extension WorkoutSplit { |
| import SwiftUI | |
| import Foundation | |
| import PlaygroundSupport | |
| public enum Orientation { | |
| case horizontal | |
| case vertical | |
| } | |
| public struct StackView<Content: View>: View { |
| //: HSTack /Scroll View With Drag and Drop | |
| // By Wilson Munoz / @yosoywil | |
| // Inspiration 1: https://gist.github.com/tarasis/f9bac6d98de5433f1ddbadaef02f9a29 | |
| // Inspiration 2: https://swiftui-lab.com/drag-drop-with-swiftui/ | |
| // Really dirty but functional, need to stress test with several items in the ScrollView/HStack and check memory. | |
| import SwiftUI | |
| import PlaygroundSupport | |
| import Combine |
| // | |
| // InterfaceController.swift | |
| // AppleWatchExample WatchKit Extension | |
| // | |
| // Created by Robert Herley on 4/28/19. | |
| // Copyright © 2019 Robert Herley. All rights reserved. | |
| // | |
| // Adapted From: https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/speedysloth_creating_a_workout |
| import UIKit | |
| struct Person: DictionaryConvertor { | |
| let name: String | |
| let job: [Job]? | |
| let errors: [String]? | |
| } | |
| struct Job: DictionaryConvertor { | |
| let title: String |
| @UIApplicationMain | |
| final class AppDelegate: UIResponder, UIApplicationDelegate { | |
| let healthKitManager = HealthKitManager() | |
| func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
| if onboardingComplete { | |
| healthKitManager.requestAccessWithCompletion() { success, error in | |
| if success { print("HealthKit access granted") } | |
| else { print("Error requesting access to HealthKit: \(error)") } | |
| } |
| i386 : iPhone Simulator | |
| x86_64 : iPhone Simulator | |
| arm64 : iPhone Simulator | |
| iPhone1,1 : iPhone | |
| iPhone1,2 : iPhone 3G | |
| iPhone2,1 : iPhone 3GS | |
| iPhone3,1 : iPhone 4 | |
| iPhone3,2 : iPhone 4 GSM Rev A | |
| iPhone3,3 : iPhone 4 CDMA | |
| iPhone4,1 : iPhone 4S |