├── demo.gif ├── README.md ├── Binary7SegmentCore ├── README.md ├── .gitignore ├── Tests │ ├── LinuxMain.swift │ └── Binary7SegmentCoreTests │ │ ├── XCTestManifests.swift │ │ └── Binary7SegmentCoreTests.swift ├── Package.swift └── Sources │ └── Binary7SegmentCore │ └── Binary7SegmentCore.swift ├── 7SegmentDisplay ├── Assets.xcassets │ ├── Contents.json │ ├── AppIcon.appiconset │ │ ├── ItunesArtwork@2x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ ├── ItunesArtwork@2x-1.png │ │ ├── Icon-App-83.5x83.5@2x.png │ │ └── Contents.json │ └── SegmentBG.colorset │ │ └── Contents.json ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── AppDelegate.swift ├── Base.lproj │ └── LaunchScreen.storyboard ├── ContentView.swift ├── Info.plist ├── SceneDelegate.swift └── Decimal7View.swift ├── 7SegmentDisplay.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcuserdata │ └── ios.yu.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── project.pbxproj └── 7SegmentDisplayUITests ├── Info.plist └── _SegmentDisplayUITests.swift /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/demo.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SwiftUI Decimal 7 segment Display 2 | 3 | ![demo.gif](demo.gif) 4 | -------------------------------------------------------------------------------- /Binary7SegmentCore/README.md: -------------------------------------------------------------------------------- 1 | # Binary7SegmentCore 2 | 3 | A description of this package. 4 | -------------------------------------------------------------------------------- /Binary7SegmentCore/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /7SegmentDisplay/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x-1.png -------------------------------------------------------------------------------- /Binary7SegmentCore/Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import Binary7SegmentCoreTests 4 | 5 | var tests = [XCTestCaseEntry]() 6 | tests += Binary7SegmentCoreTests.allTests() 7 | XCTMain(tests) 8 | -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-yuyut/7SegmentDisplay/HEAD/7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /7SegmentDisplay.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Binary7SegmentCore/Tests/Binary7SegmentCoreTests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | #if !canImport(ObjectiveC) 4 | public func allTests() -> [XCTestCaseEntry] { 5 | return [ 6 | testCase(Binary7SegmentCoreTests.allTests), 7 | ] 8 | } 9 | #endif 10 | -------------------------------------------------------------------------------- /7SegmentDisplay.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /7SegmentDisplay.xcodeproj/xcuserdata/ios.yu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 7SegmentDisplay.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/SegmentBG.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "gray-gamma-22", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "white" : "0.900" 9 | } 10 | }, 11 | "idiom" : "universal" 12 | }, 13 | { 14 | "appearances" : [ 15 | { 16 | "appearance" : "luminosity", 17 | "value" : "dark" 18 | } 19 | ], 20 | "color" : { 21 | "color-space" : "gray-gamma-22", 22 | "components" : { 23 | "alpha" : "1.000", 24 | "white" : "0.100" 25 | } 26 | }, 27 | "idiom" : "universal" 28 | } 29 | ], 30 | "info" : { 31 | "author" : "xcode", 32 | "version" : 1 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /7SegmentDisplayUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Binary7SegmentCore/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.2 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "Binary7SegmentCore", 8 | products: [ 9 | // Products define the executables and libraries produced by a package, and make them visible to other packages. 10 | .library( 11 | name: "Binary7SegmentCore", 12 | targets: ["Binary7SegmentCore"]), 13 | ], 14 | dependencies: [ 15 | // Dependencies declare other packages that this package depends on. 16 | // .package(url: /* package url */, from: "1.0.0"), 17 | ], 18 | targets: [ 19 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 20 | // Targets can depend on other targets in this package, and on products in packages which this package depends on. 21 | .target( 22 | name: "Binary7SegmentCore", 23 | dependencies: []), 24 | .testTarget( 25 | name: "Binary7SegmentCoreTests", 26 | dependencies: ["Binary7SegmentCore"]), 27 | ] 28 | ) 29 | -------------------------------------------------------------------------------- /7SegmentDisplay/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // 7SegmentDisplay 4 | // 5 | // Created by 游宗諭 on 2020/7/30. 6 | // Copyright © 2020 游宗諭. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /7SegmentDisplayUITests/_SegmentDisplayUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // _SegmentDisplayUITests.swift 3 | // 7SegmentDisplayUITests 4 | // 5 | // Created by 游宗諭 on 2020/7/30. 6 | // Copyright © 2020 游宗諭. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class _SegmentDisplayUITests: XCTestCase { 12 | 13 | override func setUpWithError() throws { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | continueAfterFailure = false 18 | 19 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 20 | } 21 | 22 | override func tearDownWithError() throws { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | } 25 | 26 | func testExample() throws { 27 | // UI tests must launch the application that they test. 28 | let app = XCUIApplication() 29 | app.launch() 30 | 31 | // Use recording to get started writing UI tests. 32 | // Use XCTAssert and related functions to verify your tests produce the correct results. 33 | } 34 | 35 | func testLaunchPerformance() throws { 36 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 37 | // This measures how long it takes to launch your application. 38 | measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { 39 | XCUIApplication().launch() 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /7SegmentDisplay/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /7SegmentDisplay/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // 7SegmentDisplay 4 | // 5 | // Created by 游宗諭 on 2020/7/30. 6 | // Copyright © 2020 游宗諭. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import Binary7SegmentCore 11 | 12 | struct ContentView: View { 13 | @State var byte = Byte() 14 | @State var value = 0 15 | private let animationFlag: Animation = .easeInOut 16 | var body: some View { 17 | VStack { 18 | Text("Decimal 7 Segment") 19 | 20 | HStack { 21 | VStack { 22 | Text("A") 23 | Toggle(isOn: $byte._A.animation(animationFlag)) { 24 | Text("A") 25 | } 26 | } 27 | 28 | VStack { 29 | Text("B") 30 | Toggle("",isOn: $byte._B.animation(animationFlag)) 31 | } 32 | VStack { 33 | Text("C") 34 | Toggle("",isOn: $byte._C.animation(animationFlag)) 35 | } 36 | VStack { 37 | Text("D") 38 | Toggle("",isOn: $byte._D.animation(animationFlag)) 39 | } 40 | VStack { 41 | Text(byte.value.description) 42 | Stepper("", value: self.$byte.value.animation(animationFlag), in: 0...9, step: 1) 43 | .labelsHidden() 44 | } 45 | .padding(.horizontal) 46 | } 47 | Decimal7View(cirCuits: byte.makeDecimal()) 48 | .padding(40) 49 | } 50 | } 51 | } 52 | 53 | struct ContentView_Previews: PreviewProvider { 54 | static var previews: some View { 55 | ContentView() 56 | } 57 | } 58 | 59 | extension Byte { 60 | func makeDecimal() -> ByteCirCuits { 61 | ByteCirCuits(byte: self) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /7SegmentDisplay/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Binary7SegmentCore/Sources/Binary7SegmentCore/Binary7SegmentCore.swift: -------------------------------------------------------------------------------- 1 | struct Binary7SegmentCore { 2 | } 3 | public struct Byte { 4 | public init() { 5 | self._D = false 6 | self._C = false 7 | self._B = false 8 | self._A = false 9 | } 10 | 11 | public var _D,_C,_B,_A:Bool 12 | public var list:[Bool] { 13 | [ 14 | _A, 15 | _B, 16 | _C, 17 | _D, 18 | ] 19 | 20 | } 21 | public var value:Int { 22 | get { 23 | var i = 0 24 | i += _D ? 1 : 0 25 | i += _C ? 2 : 0 26 | i += _B ? 4 : 0 27 | i += _A ? 8 : 0 28 | return i 29 | } 30 | set { 31 | assert(newValue < 10) 32 | _D = 1 & newValue == 1 33 | _C = 2 & newValue == 2 34 | _B = 4 & newValue == 4 35 | _A = 8 & newValue == 8 36 | 37 | } 38 | } 39 | mutating public func changeTo(_ boolList:[Bool]) { 40 | assert(boolList.count == 4) 41 | _D = boolList[3] 42 | _C = boolList[2] 43 | _B = boolList[1] 44 | _A = boolList[0] 45 | } 46 | mutating public func reset() { 47 | _D = false 48 | _C = false 49 | _B = false 50 | _A = false 51 | } 52 | } 53 | 54 | public struct ByteCirCuits { 55 | public init(byte: Byte) { 56 | self.byte = byte 57 | var andList = Array(repeating: false, count: 9) 58 | var orList = Array(repeating: false, count: 7) 59 | andList[00] = byte._B .and(byte._D) 60 | andList[01] = byte._B.n.and(byte._D.n) 61 | andList[02] = byte._C .and(byte._D) 62 | andList[03] = byte._C.n.and(byte._D.n) 63 | andList[04] = byte._C .and(byte._D.n) 64 | andList[05] = byte._B.n.and(byte._C) 65 | andList[07] = byte._B .and(byte._C.n) 66 | andList[08] = byte._B .and(byte._D.n) 67 | andList[06] = byte._D .and(andList[7]) 68 | 69 | orList[00] = (andList[0] || andList[1] || byte._A || byte._C) 70 | orList[01] = (andList[2] || byte._B.n || andList[3]) 71 | orList[02] = (byte._B || byte._C.n || byte._D) 72 | orList[03] = (byte._A || andList[1] || andList[4] || andList[5] || andList[6]) 73 | orList[04] = (andList[4] || andList[1]) 74 | orList[05] = andList[3] || andList[8] || andList[7] || byte._A 75 | orList[06] = andList[4] || andList[5] || andList[7] || byte._A || andList[6] 76 | self.andList = andList 77 | self.orList = orList 78 | } 79 | 80 | public let andList :Array 81 | public let orList :Array 82 | public let byte:Byte 83 | } 84 | 85 | extension Bool { 86 | var n:Bool {!self} 87 | func and(_ b:Bool) -> Bool { 88 | self && b 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /7SegmentDisplay/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // 7SegmentDisplay 4 | // 5 | // Created by 游宗諭 on 2020/7/30. 6 | // Copyright © 2020 游宗諭. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftUI 11 | 12 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 18 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 19 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 20 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 21 | 22 | // Create the SwiftUI view that provides the window contents. 23 | let contentView = ContentView() 24 | 25 | // Use a UIHostingController as window root view controller. 26 | if let windowScene = scene as? UIWindowScene { 27 | let window = UIWindow(windowScene: windowScene) 28 | window.rootViewController = UIHostingController(rootView: contentView) 29 | self.window = window 30 | window.makeKeyAndVisible() 31 | } 32 | } 33 | 34 | func sceneDidDisconnect(_ scene: UIScene) { 35 | // Called as the scene is being released by the system. 36 | // This occurs shortly after the scene enters the background, or when its session is discarded. 37 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 38 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 39 | } 40 | 41 | func sceneDidBecomeActive(_ scene: UIScene) { 42 | // Called when the scene has moved from an inactive state to an active state. 43 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 44 | } 45 | 46 | func sceneWillResignActive(_ scene: UIScene) { 47 | // Called when the scene will move from an active state to an inactive state. 48 | // This may occur due to temporary interruptions (ex. an incoming phone call). 49 | } 50 | 51 | func sceneWillEnterForeground(_ scene: UIScene) { 52 | // Called as the scene transitions from the background to the foreground. 53 | // Use this method to undo the changes made on entering the background. 54 | } 55 | 56 | func sceneDidEnterBackground(_ scene: UIScene) { 57 | // Called as the scene transitions from the foreground to the background. 58 | // Use this method to save data, release shared resources, and store enough scene-specific state information 59 | // to restore the scene back to its current state. 60 | } 61 | 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /7SegmentDisplay/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Icon-App-20x20@2x.png", 5 | "idiom" : "iphone", 6 | "scale" : "2x", 7 | "size" : "20x20" 8 | }, 9 | { 10 | "filename" : "Icon-App-20x20@3x.png", 11 | "idiom" : "iphone", 12 | "scale" : "3x", 13 | "size" : "20x20" 14 | }, 15 | { 16 | "filename" : "Icon-App-29x29@1x.png", 17 | "idiom" : "iphone", 18 | "scale" : "1x", 19 | "size" : "29x29" 20 | }, 21 | { 22 | "filename" : "Icon-App-29x29@2x.png", 23 | "idiom" : "iphone", 24 | "scale" : "2x", 25 | "size" : "29x29" 26 | }, 27 | { 28 | "filename" : "Icon-App-29x29@3x.png", 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "29x29" 32 | }, 33 | { 34 | "filename" : "Icon-App-40x40@2x.png", 35 | "idiom" : "iphone", 36 | "scale" : "2x", 37 | "size" : "40x40" 38 | }, 39 | { 40 | "filename" : "Icon-App-40x40@3x.png", 41 | "idiom" : "iphone", 42 | "scale" : "3x", 43 | "size" : "40x40" 44 | }, 45 | { 46 | "filename" : "Icon-App-60x60@2x.png", 47 | "idiom" : "iphone", 48 | "scale" : "2x", 49 | "size" : "60x60" 50 | }, 51 | { 52 | "filename" : "Icon-App-60x60@3x.png", 53 | "idiom" : "iphone", 54 | "scale" : "3x", 55 | "size" : "60x60" 56 | }, 57 | { 58 | "filename" : "Icon-App-20x20@1x.png", 59 | "idiom" : "ipad", 60 | "scale" : "1x", 61 | "size" : "20x20" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "2x", 66 | "size" : "20x20" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "1x", 71 | "size" : "29x29" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "2x", 76 | "size" : "29x29" 77 | }, 78 | { 79 | "filename" : "Icon-App-40x40@1x.png", 80 | "idiom" : "ipad", 81 | "scale" : "1x", 82 | "size" : "40x40" 83 | }, 84 | { 85 | "idiom" : "ipad", 86 | "scale" : "2x", 87 | "size" : "40x40" 88 | }, 89 | { 90 | "filename" : "Icon-App-76x76@1x.png", 91 | "idiom" : "ipad", 92 | "scale" : "1x", 93 | "size" : "76x76" 94 | }, 95 | { 96 | "filename" : "Icon-App-76x76@2x.png", 97 | "idiom" : "ipad", 98 | "scale" : "2x", 99 | "size" : "76x76" 100 | }, 101 | { 102 | "filename" : "Icon-App-83.5x83.5@2x.png", 103 | "idiom" : "ipad", 104 | "scale" : "2x", 105 | "size" : "83.5x83.5" 106 | }, 107 | { 108 | "filename" : "ItunesArtwork@2x.png", 109 | "idiom" : "ios-marketing", 110 | "scale" : "1x", 111 | "size" : "1024x1024" 112 | }, 113 | { 114 | "filename" : "ItunesArtwork@2x-1.png", 115 | "idiom" : "mac", 116 | "scale" : "2x", 117 | "size" : "512x512" 118 | } 119 | ], 120 | "info" : { 121 | "author" : "xcode", 122 | "version" : 1 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /7SegmentDisplay/Decimal7View.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Decimal7View.swift 3 | // 7SegmentDisplay 4 | // 5 | // Created by 游宗諭 on 2020/7/30. 6 | // Copyright © 2020 游宗諭. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import Binary7SegmentCore 11 | struct Decimal7View:View { 12 | var cirCuits: ByteCirCuits 13 | let i1:CGFloat = 10 14 | let i2:CGFloat = 1.2 15 | var body: some View { 16 | GeometryReader { 17 | proxy in 18 | VStack { 19 | SegmentTextV("a", isActive: self.cirCuits.orList[0]) 20 | .frame(width: proxy.size.width / self.i2, 21 | height: proxy.size.height / self.i1) 22 | HStack() { 23 | SegmentTextH("f", isActive: self.cirCuits.orList[5]) 24 | .frame(width: proxy.size.height / self.i1) 25 | Spacer(minLength: proxy.size.width * 3 / 4) 26 | SegmentTextH("b", isActive: self.cirCuits.orList[1]) 27 | .frame(width: proxy.size.height / self.i1) 28 | } 29 | SegmentTextV("g", isActive: self.cirCuits.orList[6]) 30 | .frame(width: proxy.size.width / self.i2, 31 | height: proxy.size.height / self.i1) 32 | 33 | HStack { 34 | SegmentTextH("e", isActive: self.cirCuits.orList[4]) 35 | .frame(width: proxy.size.height / self.i1) 36 | Spacer(minLength: proxy.size.width * 3 / 4) 37 | SegmentTextH("c", isActive: self.cirCuits.orList[2]) 38 | .frame(width: proxy.size.height / self.i1) 39 | } 40 | Divider() 41 | SegmentTextV("d", isActive: self.cirCuits.orList[3]) 42 | .frame(width: proxy.size.width / self.i2, 43 | height: proxy.size.height / self.i1) 44 | } 45 | } 46 | .padding() 47 | } 48 | } 49 | 50 | extension Color { 51 | static var grayMy:Color { Color("SegmentBG")} 52 | } 53 | 54 | struct SegmentTextH:View { 55 | init(_ text: String, isActive: Bool) { 56 | self.text = text 57 | self.isActive = isActive 58 | } 59 | 60 | var text:String 61 | var isActive:Bool 62 | var body: some View{ 63 | GeometryReader { 64 | (proxy:GeometryProxy) in 65 | Text(self.text) 66 | .frame(width: proxy.size.width, height: proxy.size.height, alignment: .center) 67 | .background(self.isActive ? Color.red : Color.grayMy) 68 | .foregroundColor(Color.white) 69 | .cornerRadius(proxy.size.width / 2) 70 | } 71 | } 72 | } 73 | struct SegmentTextV:View { 74 | init(_ text: String, isActive: Bool) { 75 | self.text = text 76 | self.isActive = isActive 77 | } 78 | 79 | var text:String 80 | var isActive:Bool 81 | var body: some View{ 82 | GeometryReader { 83 | (proxy:GeometryProxy) in 84 | Text(self.text) 85 | .frame(width: proxy.size.width , height: proxy.size.height, alignment: .center) 86 | .background(self.isActive ? Color.red : Color.grayMy) 87 | .foregroundColor(Color.white) 88 | .cornerRadius(proxy.size.height / 2 ) 89 | } 90 | } 91 | } 92 | 93 | struct Decimal7View_Previews: PreviewProvider { 94 | static var previews: some View { 95 | Decimal7View(cirCuits: .init(byte: Byte())) 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /Binary7SegmentCore/Tests/Binary7SegmentCoreTests/Binary7SegmentCoreTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import Binary7SegmentCore 3 | 4 | final class Binary7SegmentCoreTests: XCTestCase { 5 | fileprivate func testValue(_ list: Int, _ expect: Int) { 6 | var byte = Byte() 7 | byte.changeTo(list.boolList(count: 4)) 8 | XCTAssertEqual(byte.value, expect,"\(list) expect \(expect), but found \(byte.value)") 9 | } 10 | 11 | func testGetValue() { 12 | let testList = [ 13 | (0000, 0), 14 | (0001, 1), 15 | (0010, 2), 16 | (0011, 3), 17 | (0100, 4), 18 | (0101, 5), 19 | (0110, 6), 20 | (0111, 7), 21 | (1000, 8), 22 | (1001, 9), 23 | ] 24 | 25 | for (list, expect) in testList { 26 | testValue(list, expect) 27 | } 28 | 29 | for (expect, value) in testList { 30 | var byte = Byte() 31 | byte.value = value 32 | XCTAssertEqual(expect.boolList(count: 4), byte.list, "value:\(value) expect \(expect.boolList(count: 4)) but found \(byte.list)") 33 | } 34 | } 35 | func testOrList() { 36 | let testList = [ 37 | (0000, 010100000, 1111110), 38 | (0001, 000000000, 0110000), 39 | (0010, 010011000, 1101101), 40 | (0011, 001001000, 1111001), 41 | (0100, 000100011, 0110011), 42 | (0101, 100000110, 1011011), 43 | (0110, 000010001, 1011111), 44 | (0111, 101000000, 1110000), 45 | (1000, 010100000, 1111111), 46 | (1001, 000000000, 1111011), 47 | ] 48 | 49 | for (list, expect1, expect2) in testList { 50 | var byte = Byte() 51 | byte.changeTo(list.boolList(count: 4)) 52 | let byteCircuits = ByteCirCuits(byte: byte) 53 | XCTAssertEqual(byteCircuits.andList.count, 9) 54 | XCTAssertEqual(byteCircuits.orList.count, 7) 55 | XCTAssertEqual( 56 | expect1.boolList(count: 9), byteCircuits.andList 57 | ) 58 | XCTAssertEqual(expect2.boolList(count: 7), byteCircuits.orList, "\(list) expected \(expect2.boolList(count: 7)) but found \(byteCircuits.orList)") 59 | } 60 | 61 | } 62 | func testIntToBoolList() { 63 | let list = [ (0000,[0,0,0,0]), 64 | (0001,[0,0,0,1]), 65 | (0010,[0,0,1,0]), 66 | (0011,[0,0,1,1]), 67 | (0100,[0,1,0,0]), 68 | (0101,[0,1,0,1]), 69 | (0110,[0,1,1,0]), 70 | (0111,[0,1,1,1]), 71 | (1000,[1,0,0,0]), 72 | (1001,[1,0,0,1])] 73 | for i in list { 74 | let result = i.0.boolList(count: 4) 75 | let expect = i.1 76 | XCTAssertEqual(result, expect.booled()) 77 | } 78 | 79 | } 80 | static var allTests = [ 81 | ("testGetValue", testGetValue), 82 | ] 83 | } 84 | 85 | extension Array where Element == Int { 86 | func booled() -> [Bool] { 87 | map{$0 != 0} 88 | } 89 | } 90 | 91 | extension Int { 92 | func boolList(count:Int) -> [Bool] { 93 | var copy = self 94 | var re = [Bool]() 95 | while copy > 0 { 96 | re.append(copy % 10 == 0 ? false : true) 97 | copy /= 10 98 | } 99 | while re.count < count { 100 | re.append(false) 101 | } 102 | return re.reversed() 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /7SegmentDisplay.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 52; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A787CCBF24D279C50030B1A8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A787CCBE24D279C50030B1A8 /* AppDelegate.swift */; }; 11 | A787CCC124D279C50030B1A8 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A787CCC024D279C50030B1A8 /* SceneDelegate.swift */; }; 12 | A787CCC324D279C50030B1A8 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A787CCC224D279C50030B1A8 /* ContentView.swift */; }; 13 | A787CCC524D279C70030B1A8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A787CCC424D279C70030B1A8 /* Assets.xcassets */; }; 14 | A787CCC824D279C80030B1A8 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A787CCC724D279C80030B1A8 /* Preview Assets.xcassets */; }; 15 | A787CCCB24D279C80030B1A8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A787CCC924D279C80030B1A8 /* LaunchScreen.storyboard */; }; 16 | A787CCD624D279C80030B1A8 /* _SegmentDisplayUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A787CCD524D279C80030B1A8 /* _SegmentDisplayUITests.swift */; }; 17 | A787CCE324D2A15B0030B1A8 /* Binary7SegmentCore in Frameworks */ = {isa = PBXBuildFile; productRef = A787CCE224D2A15B0030B1A8 /* Binary7SegmentCore */; }; 18 | A787CCE524D2A3160030B1A8 /* Decimal7View.swift in Sources */ = {isa = PBXBuildFile; fileRef = A787CCE424D2A3160030B1A8 /* Decimal7View.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | A787CCD224D279C80030B1A8 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = A787CCB324D279C50030B1A8 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = A787CCBA24D279C50030B1A8; 27 | remoteInfo = 7SegmentDisplay; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | A787CCBB24D279C50030B1A8 /* 7SegmentDisplay.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = 7SegmentDisplay.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | A787CCBE24D279C50030B1A8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 34 | A787CCC024D279C50030B1A8 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 35 | A787CCC224D279C50030B1A8 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 36 | A787CCC424D279C70030B1A8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 37 | A787CCC724D279C80030B1A8 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 38 | A787CCCA24D279C80030B1A8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 39 | A787CCCC24D279C80030B1A8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | A787CCD124D279C80030B1A8 /* 7SegmentDisplayUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = 7SegmentDisplayUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | A787CCD524D279C80030B1A8 /* _SegmentDisplayUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = _SegmentDisplayUITests.swift; sourceTree = ""; }; 42 | A787CCD724D279C80030B1A8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | A787CCE024D27A0E0030B1A8 /* Binary7SegmentCore */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Binary7SegmentCore; sourceTree = ""; }; 44 | A787CCE424D2A3160030B1A8 /* Decimal7View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Decimal7View.swift; sourceTree = ""; }; 45 | A787CCE624D2B6060030B1A8 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 46 | A787CCE724D2B6BB0030B1A8 /* demo.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = demo.gif; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | A787CCB824D279C50030B1A8 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | A787CCE324D2A15B0030B1A8 /* Binary7SegmentCore in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | A787CCCE24D279C80030B1A8 /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | A787CCB224D279C50030B1A8 = { 69 | isa = PBXGroup; 70 | children = ( 71 | A787CCE624D2B6060030B1A8 /* README.md */, 72 | A787CCE724D2B6BB0030B1A8 /* demo.gif */, 73 | A787CCE024D27A0E0030B1A8 /* Binary7SegmentCore */, 74 | A787CCBD24D279C50030B1A8 /* 7SegmentDisplay */, 75 | A787CCD424D279C80030B1A8 /* 7SegmentDisplayUITests */, 76 | A787CCBC24D279C50030B1A8 /* Products */, 77 | A787CCE124D2A15B0030B1A8 /* Frameworks */, 78 | ); 79 | sourceTree = ""; 80 | }; 81 | A787CCBC24D279C50030B1A8 /* Products */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | A787CCBB24D279C50030B1A8 /* 7SegmentDisplay.app */, 85 | A787CCD124D279C80030B1A8 /* 7SegmentDisplayUITests.xctest */, 86 | ); 87 | name = Products; 88 | sourceTree = ""; 89 | }; 90 | A787CCBD24D279C50030B1A8 /* 7SegmentDisplay */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | A787CCBE24D279C50030B1A8 /* AppDelegate.swift */, 94 | A787CCC024D279C50030B1A8 /* SceneDelegate.swift */, 95 | A787CCC224D279C50030B1A8 /* ContentView.swift */, 96 | A787CCE424D2A3160030B1A8 /* Decimal7View.swift */, 97 | A787CCC424D279C70030B1A8 /* Assets.xcassets */, 98 | A787CCC924D279C80030B1A8 /* LaunchScreen.storyboard */, 99 | A787CCCC24D279C80030B1A8 /* Info.plist */, 100 | A787CCC624D279C80030B1A8 /* Preview Content */, 101 | ); 102 | path = 7SegmentDisplay; 103 | sourceTree = ""; 104 | }; 105 | A787CCC624D279C80030B1A8 /* Preview Content */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | A787CCC724D279C80030B1A8 /* Preview Assets.xcassets */, 109 | ); 110 | path = "Preview Content"; 111 | sourceTree = ""; 112 | }; 113 | A787CCD424D279C80030B1A8 /* 7SegmentDisplayUITests */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | A787CCD524D279C80030B1A8 /* _SegmentDisplayUITests.swift */, 117 | A787CCD724D279C80030B1A8 /* Info.plist */, 118 | ); 119 | path = 7SegmentDisplayUITests; 120 | sourceTree = ""; 121 | }; 122 | A787CCE124D2A15B0030B1A8 /* Frameworks */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | ); 126 | name = Frameworks; 127 | sourceTree = ""; 128 | }; 129 | /* End PBXGroup section */ 130 | 131 | /* Begin PBXNativeTarget section */ 132 | A787CCBA24D279C50030B1A8 /* 7SegmentDisplay */ = { 133 | isa = PBXNativeTarget; 134 | buildConfigurationList = A787CCDA24D279C80030B1A8 /* Build configuration list for PBXNativeTarget "7SegmentDisplay" */; 135 | buildPhases = ( 136 | A787CCB724D279C50030B1A8 /* Sources */, 137 | A787CCB824D279C50030B1A8 /* Frameworks */, 138 | A787CCB924D279C50030B1A8 /* Resources */, 139 | ); 140 | buildRules = ( 141 | ); 142 | dependencies = ( 143 | ); 144 | name = 7SegmentDisplay; 145 | packageProductDependencies = ( 146 | A787CCE224D2A15B0030B1A8 /* Binary7SegmentCore */, 147 | ); 148 | productName = 7SegmentDisplay; 149 | productReference = A787CCBB24D279C50030B1A8 /* 7SegmentDisplay.app */; 150 | productType = "com.apple.product-type.application"; 151 | }; 152 | A787CCD024D279C80030B1A8 /* 7SegmentDisplayUITests */ = { 153 | isa = PBXNativeTarget; 154 | buildConfigurationList = A787CCDD24D279C80030B1A8 /* Build configuration list for PBXNativeTarget "7SegmentDisplayUITests" */; 155 | buildPhases = ( 156 | A787CCCD24D279C80030B1A8 /* Sources */, 157 | A787CCCE24D279C80030B1A8 /* Frameworks */, 158 | A787CCCF24D279C80030B1A8 /* Resources */, 159 | ); 160 | buildRules = ( 161 | ); 162 | dependencies = ( 163 | A787CCD324D279C80030B1A8 /* PBXTargetDependency */, 164 | ); 165 | name = 7SegmentDisplayUITests; 166 | productName = 7SegmentDisplayUITests; 167 | productReference = A787CCD124D279C80030B1A8 /* 7SegmentDisplayUITests.xctest */; 168 | productType = "com.apple.product-type.bundle.ui-testing"; 169 | }; 170 | /* End PBXNativeTarget section */ 171 | 172 | /* Begin PBXProject section */ 173 | A787CCB324D279C50030B1A8 /* Project object */ = { 174 | isa = PBXProject; 175 | attributes = { 176 | LastSwiftUpdateCheck = 1150; 177 | LastUpgradeCheck = 1150; 178 | ORGANIZATIONNAME = "游宗諭"; 179 | TargetAttributes = { 180 | A787CCBA24D279C50030B1A8 = { 181 | CreatedOnToolsVersion = 11.5; 182 | }; 183 | A787CCD024D279C80030B1A8 = { 184 | CreatedOnToolsVersion = 11.5; 185 | TestTargetID = A787CCBA24D279C50030B1A8; 186 | }; 187 | }; 188 | }; 189 | buildConfigurationList = A787CCB624D279C50030B1A8 /* Build configuration list for PBXProject "7SegmentDisplay" */; 190 | compatibilityVersion = "Xcode 9.3"; 191 | developmentRegion = en; 192 | hasScannedForEncodings = 0; 193 | knownRegions = ( 194 | en, 195 | Base, 196 | ); 197 | mainGroup = A787CCB224D279C50030B1A8; 198 | productRefGroup = A787CCBC24D279C50030B1A8 /* Products */; 199 | projectDirPath = ""; 200 | projectRoot = ""; 201 | targets = ( 202 | A787CCBA24D279C50030B1A8 /* 7SegmentDisplay */, 203 | A787CCD024D279C80030B1A8 /* 7SegmentDisplayUITests */, 204 | ); 205 | }; 206 | /* End PBXProject section */ 207 | 208 | /* Begin PBXResourcesBuildPhase section */ 209 | A787CCB924D279C50030B1A8 /* Resources */ = { 210 | isa = PBXResourcesBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | A787CCCB24D279C80030B1A8 /* LaunchScreen.storyboard in Resources */, 214 | A787CCC824D279C80030B1A8 /* Preview Assets.xcassets in Resources */, 215 | A787CCC524D279C70030B1A8 /* Assets.xcassets in Resources */, 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | A787CCCF24D279C80030B1A8 /* Resources */ = { 220 | isa = PBXResourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | /* End PBXResourcesBuildPhase section */ 227 | 228 | /* Begin PBXSourcesBuildPhase section */ 229 | A787CCB724D279C50030B1A8 /* Sources */ = { 230 | isa = PBXSourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | A787CCBF24D279C50030B1A8 /* AppDelegate.swift in Sources */, 234 | A787CCC124D279C50030B1A8 /* SceneDelegate.swift in Sources */, 235 | A787CCE524D2A3160030B1A8 /* Decimal7View.swift in Sources */, 236 | A787CCC324D279C50030B1A8 /* ContentView.swift in Sources */, 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | A787CCCD24D279C80030B1A8 /* Sources */ = { 241 | isa = PBXSourcesBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | A787CCD624D279C80030B1A8 /* _SegmentDisplayUITests.swift in Sources */, 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | /* End PBXSourcesBuildPhase section */ 249 | 250 | /* Begin PBXTargetDependency section */ 251 | A787CCD324D279C80030B1A8 /* PBXTargetDependency */ = { 252 | isa = PBXTargetDependency; 253 | target = A787CCBA24D279C50030B1A8 /* 7SegmentDisplay */; 254 | targetProxy = A787CCD224D279C80030B1A8 /* PBXContainerItemProxy */; 255 | }; 256 | /* End PBXTargetDependency section */ 257 | 258 | /* Begin PBXVariantGroup section */ 259 | A787CCC924D279C80030B1A8 /* LaunchScreen.storyboard */ = { 260 | isa = PBXVariantGroup; 261 | children = ( 262 | A787CCCA24D279C80030B1A8 /* Base */, 263 | ); 264 | name = LaunchScreen.storyboard; 265 | sourceTree = ""; 266 | }; 267 | /* End PBXVariantGroup section */ 268 | 269 | /* Begin XCBuildConfiguration section */ 270 | A787CCD824D279C80030B1A8 /* Debug */ = { 271 | isa = XCBuildConfiguration; 272 | buildSettings = { 273 | ALWAYS_SEARCH_USER_PATHS = NO; 274 | CLANG_ANALYZER_NONNULL = YES; 275 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 276 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 277 | CLANG_CXX_LIBRARY = "libc++"; 278 | CLANG_ENABLE_MODULES = YES; 279 | CLANG_ENABLE_OBJC_ARC = YES; 280 | CLANG_ENABLE_OBJC_WEAK = YES; 281 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 282 | CLANG_WARN_BOOL_CONVERSION = YES; 283 | CLANG_WARN_COMMA = YES; 284 | CLANG_WARN_CONSTANT_CONVERSION = YES; 285 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 286 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 287 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 288 | CLANG_WARN_EMPTY_BODY = YES; 289 | CLANG_WARN_ENUM_CONVERSION = YES; 290 | CLANG_WARN_INFINITE_RECURSION = YES; 291 | CLANG_WARN_INT_CONVERSION = YES; 292 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 293 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 294 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 295 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 296 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 297 | CLANG_WARN_STRICT_PROTOTYPES = YES; 298 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 299 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 300 | CLANG_WARN_UNREACHABLE_CODE = YES; 301 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 302 | COPY_PHASE_STRIP = NO; 303 | DEBUG_INFORMATION_FORMAT = dwarf; 304 | ENABLE_STRICT_OBJC_MSGSEND = YES; 305 | ENABLE_TESTABILITY = YES; 306 | GCC_C_LANGUAGE_STANDARD = gnu11; 307 | GCC_DYNAMIC_NO_PIC = NO; 308 | GCC_NO_COMMON_BLOCKS = YES; 309 | GCC_OPTIMIZATION_LEVEL = 0; 310 | GCC_PREPROCESSOR_DEFINITIONS = ( 311 | "DEBUG=1", 312 | "$(inherited)", 313 | ); 314 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 315 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 316 | GCC_WARN_UNDECLARED_SELECTOR = YES; 317 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 318 | GCC_WARN_UNUSED_FUNCTION = YES; 319 | GCC_WARN_UNUSED_VARIABLE = YES; 320 | IPHONEOS_DEPLOYMENT_TARGET = 13.5; 321 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 322 | MTL_FAST_MATH = YES; 323 | ONLY_ACTIVE_ARCH = YES; 324 | SDKROOT = iphoneos; 325 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 326 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 327 | }; 328 | name = Debug; 329 | }; 330 | A787CCD924D279C80030B1A8 /* Release */ = { 331 | isa = XCBuildConfiguration; 332 | buildSettings = { 333 | ALWAYS_SEARCH_USER_PATHS = NO; 334 | CLANG_ANALYZER_NONNULL = YES; 335 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 336 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 337 | CLANG_CXX_LIBRARY = "libc++"; 338 | CLANG_ENABLE_MODULES = YES; 339 | CLANG_ENABLE_OBJC_ARC = YES; 340 | CLANG_ENABLE_OBJC_WEAK = YES; 341 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 342 | CLANG_WARN_BOOL_CONVERSION = YES; 343 | CLANG_WARN_COMMA = YES; 344 | CLANG_WARN_CONSTANT_CONVERSION = YES; 345 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 348 | CLANG_WARN_EMPTY_BODY = YES; 349 | CLANG_WARN_ENUM_CONVERSION = YES; 350 | CLANG_WARN_INFINITE_RECURSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 354 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 355 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 356 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 357 | CLANG_WARN_STRICT_PROTOTYPES = YES; 358 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 359 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 360 | CLANG_WARN_UNREACHABLE_CODE = YES; 361 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 362 | COPY_PHASE_STRIP = NO; 363 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 364 | ENABLE_NS_ASSERTIONS = NO; 365 | ENABLE_STRICT_OBJC_MSGSEND = YES; 366 | GCC_C_LANGUAGE_STANDARD = gnu11; 367 | GCC_NO_COMMON_BLOCKS = YES; 368 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 369 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 370 | GCC_WARN_UNDECLARED_SELECTOR = YES; 371 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 372 | GCC_WARN_UNUSED_FUNCTION = YES; 373 | GCC_WARN_UNUSED_VARIABLE = YES; 374 | IPHONEOS_DEPLOYMENT_TARGET = 13.5; 375 | MTL_ENABLE_DEBUG_INFO = NO; 376 | MTL_FAST_MATH = YES; 377 | SDKROOT = iphoneos; 378 | SWIFT_COMPILATION_MODE = wholemodule; 379 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 380 | VALIDATE_PRODUCT = YES; 381 | }; 382 | name = Release; 383 | }; 384 | A787CCDB24D279C80030B1A8 /* Debug */ = { 385 | isa = XCBuildConfiguration; 386 | buildSettings = { 387 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 388 | CODE_SIGN_STYLE = Automatic; 389 | DEVELOPMENT_ASSET_PATHS = "\"7SegmentDisplay/Preview Content\""; 390 | DEVELOPMENT_TEAM = 3AMPL46LPV; 391 | ENABLE_PREVIEWS = YES; 392 | INFOPLIST_FILE = 7SegmentDisplay/Info.plist; 393 | LD_RUNPATH_SEARCH_PATHS = ( 394 | "$(inherited)", 395 | "@executable_path/Frameworks", 396 | ); 397 | PRODUCT_BUNDLE_IDENTIFIER = "com.ytyubox.-SegmentDisplay"; 398 | PRODUCT_NAME = "$(TARGET_NAME)"; 399 | SWIFT_VERSION = 5.0; 400 | TARGETED_DEVICE_FAMILY = "1,2"; 401 | }; 402 | name = Debug; 403 | }; 404 | A787CCDC24D279C80030B1A8 /* Release */ = { 405 | isa = XCBuildConfiguration; 406 | buildSettings = { 407 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 408 | CODE_SIGN_STYLE = Automatic; 409 | DEVELOPMENT_ASSET_PATHS = "\"7SegmentDisplay/Preview Content\""; 410 | DEVELOPMENT_TEAM = 3AMPL46LPV; 411 | ENABLE_PREVIEWS = YES; 412 | INFOPLIST_FILE = 7SegmentDisplay/Info.plist; 413 | LD_RUNPATH_SEARCH_PATHS = ( 414 | "$(inherited)", 415 | "@executable_path/Frameworks", 416 | ); 417 | PRODUCT_BUNDLE_IDENTIFIER = "com.ytyubox.-SegmentDisplay"; 418 | PRODUCT_NAME = "$(TARGET_NAME)"; 419 | SWIFT_VERSION = 5.0; 420 | TARGETED_DEVICE_FAMILY = "1,2"; 421 | }; 422 | name = Release; 423 | }; 424 | A787CCDE24D279C80030B1A8 /* Debug */ = { 425 | isa = XCBuildConfiguration; 426 | buildSettings = { 427 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 428 | CODE_SIGN_STYLE = Automatic; 429 | DEVELOPMENT_TEAM = 3AMPL46LPV; 430 | INFOPLIST_FILE = 7SegmentDisplayUITests/Info.plist; 431 | LD_RUNPATH_SEARCH_PATHS = ( 432 | "$(inherited)", 433 | "@executable_path/Frameworks", 434 | "@loader_path/Frameworks", 435 | ); 436 | PRODUCT_BUNDLE_IDENTIFIER = "com.ytyubox.-SegmentDisplayUITests"; 437 | PRODUCT_NAME = "$(TARGET_NAME)"; 438 | SWIFT_VERSION = 5.0; 439 | TARGETED_DEVICE_FAMILY = "1,2"; 440 | TEST_TARGET_NAME = 7SegmentDisplay; 441 | }; 442 | name = Debug; 443 | }; 444 | A787CCDF24D279C80030B1A8 /* Release */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 448 | CODE_SIGN_STYLE = Automatic; 449 | DEVELOPMENT_TEAM = 3AMPL46LPV; 450 | INFOPLIST_FILE = 7SegmentDisplayUITests/Info.plist; 451 | LD_RUNPATH_SEARCH_PATHS = ( 452 | "$(inherited)", 453 | "@executable_path/Frameworks", 454 | "@loader_path/Frameworks", 455 | ); 456 | PRODUCT_BUNDLE_IDENTIFIER = "com.ytyubox.-SegmentDisplayUITests"; 457 | PRODUCT_NAME = "$(TARGET_NAME)"; 458 | SWIFT_VERSION = 5.0; 459 | TARGETED_DEVICE_FAMILY = "1,2"; 460 | TEST_TARGET_NAME = 7SegmentDisplay; 461 | }; 462 | name = Release; 463 | }; 464 | /* End XCBuildConfiguration section */ 465 | 466 | /* Begin XCConfigurationList section */ 467 | A787CCB624D279C50030B1A8 /* Build configuration list for PBXProject "7SegmentDisplay" */ = { 468 | isa = XCConfigurationList; 469 | buildConfigurations = ( 470 | A787CCD824D279C80030B1A8 /* Debug */, 471 | A787CCD924D279C80030B1A8 /* Release */, 472 | ); 473 | defaultConfigurationIsVisible = 0; 474 | defaultConfigurationName = Release; 475 | }; 476 | A787CCDA24D279C80030B1A8 /* Build configuration list for PBXNativeTarget "7SegmentDisplay" */ = { 477 | isa = XCConfigurationList; 478 | buildConfigurations = ( 479 | A787CCDB24D279C80030B1A8 /* Debug */, 480 | A787CCDC24D279C80030B1A8 /* Release */, 481 | ); 482 | defaultConfigurationIsVisible = 0; 483 | defaultConfigurationName = Release; 484 | }; 485 | A787CCDD24D279C80030B1A8 /* Build configuration list for PBXNativeTarget "7SegmentDisplayUITests" */ = { 486 | isa = XCConfigurationList; 487 | buildConfigurations = ( 488 | A787CCDE24D279C80030B1A8 /* Debug */, 489 | A787CCDF24D279C80030B1A8 /* Release */, 490 | ); 491 | defaultConfigurationIsVisible = 0; 492 | defaultConfigurationName = Release; 493 | }; 494 | /* End XCConfigurationList section */ 495 | 496 | /* Begin XCSwiftPackageProductDependency section */ 497 | A787CCE224D2A15B0030B1A8 /* Binary7SegmentCore */ = { 498 | isa = XCSwiftPackageProductDependency; 499 | productName = Binary7SegmentCore; 500 | }; 501 | /* End XCSwiftPackageProductDependency section */ 502 | }; 503 | rootObject = A787CCB324D279C50030B1A8 /* Project object */; 504 | } 505 | --------------------------------------------------------------------------------