├── 10fps-2.gif ├── 10fps-3.gif ├── 10fps.gif ├── LICENSE ├── ProgressMaskView.podspec ├── ProgressMaskView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcshareddata │ └── xcschemes │ │ └── ProgressMaskView.xcscheme └── xcuserdata │ └── yusoftware.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── ProgressMaskView ├── ArcShape.swift ├── Info.plist ├── LineArcRotateView.swift ├── LineArcView.swift ├── ProgressMaskBarParameter.swift ├── ProgressMaskView.h ├── ProgressMaskView.swift ├── RotateLayer.swift ├── SimpleRView.swift └── Tools.swift ├── ProgressMaskViewTests ├── Info.plist └── ProgressMaskViewTests.swift ├── README.md ├── TestProgressMaskViewApp ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── CommonParts │ ├── ParameterControlView.swift │ ├── ParameterControlView.xib │ ├── SidewayView.swift │ └── SimpleRView.swift ├── Extensions │ ├── BinaryFloatingPointExtensions.swift │ ├── CGFloatExtensions.swift │ ├── UIColorExtensions.swift │ └── UIViewExtensions.swift ├── Info.plist ├── MainTableViewController.swift ├── ParameterDemoViewController.swift ├── RandamDemoViewController.swift ├── SampleProcess.swift └── SceneDelegate.swift ├── TestProgressMaskViewAppTests ├── Info.plist └── TestProgressMaskViewTests.swift └── TestProgressMaskViewAppUITests ├── Info.plist └── TestProgressMaskViewUITests.swift /10fps-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eytyet/ProgressMaskView/5892d67e647c8669c32daaa404b273fe9fc8ffd5/10fps-2.gif -------------------------------------------------------------------------------- /10fps-3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eytyet/ProgressMaskView/5892d67e647c8669c32daaa404b273fe9fc8ffd5/10fps-3.gif -------------------------------------------------------------------------------- /10fps.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eytyet/ProgressMaskView/5892d67e647c8669c32daaa404b273fe9fc8ffd5/10fps.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 eytyet 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ProgressMaskView.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint ProgressMaskView.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |spec| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | spec.name = "ProgressMaskView" 19 | spec.version = "0.2.0" 20 | spec.summary = "A progress view with an activity indicator which covers the whole screen." 21 | 22 | # This description is used to generate tags and improve search results. 23 | # * Think: What does it do? Why did you write it? What is the focus? 24 | # * Try to keep it short, snappy and to the point. 25 | # * Write the description between the DESC delimiters below. 26 | # * Finally, don't worry about the indent, CocoaPods strips it! 27 | spec.description = <<-DESC 28 | ProgressMaskView masks entire screen to prevent user interaction, and show a circular activity indicator and a circular progressBar. This works when your root view controller is UIViewController, UINavigationController or UITabBarController. 29 | DESC 30 | spec.homepage = "https://github.com/eytyet/ProgressMaskView" 31 | spec.screenshots = "https://github.com/eytyet/ProgressMaskView/raw/97581759df7acf1ec10a5eaea61686efb8af9798/10fps.gif", "https://github.com/eytyet/ProgressMaskView/raw/97581759df7acf1ec10a5eaea61686efb8af9798/10fps-2.gif" 32 | 33 | 34 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 35 | # 36 | # Licensing your code is important. See https://choosealicense.com for more info. 37 | # CocoaPods will detect a license file if there is a named LICENSE* 38 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 39 | # 40 | 41 | spec.license = "MIT" 42 | # spec.license = { :type => "MIT", :file => "FILE_LICENSE" } 43 | 44 | 45 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 46 | # 47 | # Specify the authors of the library, with email addresses. Email addresses 48 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 49 | # accepts just a name if you'd rather not provide an email address. 50 | # 51 | # Specify a social_media_url where others can refer to, for example a twitter 52 | # profile URL. 53 | # 54 | 55 | spec.author = { "eytyet" => "eytyet@gmail.com" } 56 | # Or just: spec.author = "eytyet" 57 | # spec.social_media_url = "https://twitter.com/eytyet" 58 | 59 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 60 | # 61 | # If this Pod runs only on iOS or OS X, then specify the platform and 62 | # the deployment target. You can optionally include the target after the platform. 63 | # 64 | 65 | spec.platform = :ios, "9.3" 66 | 67 | # When using multiple platforms 68 | # spec.ios.deployment_target = "5.0" 69 | # spec.osx.deployment_target = "10.7" 70 | # spec.watchos.deployment_target = "2.0" 71 | # spec.tvos.deployment_target = "9.0" 72 | 73 | 74 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 75 | # 76 | # Specify the location from where the source should be retrieved. 77 | # Supports git, hg, bzr, svn and HTTP. 78 | # 79 | 80 | spec.source = { :git => "https://github.com/eytyet/ProgressMaskView.git", :tag => "#{spec.version}" } 81 | 82 | 83 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 84 | # 85 | # CocoaPods is smart about how it includes source code. For source files 86 | # giving a folder will include any swift, h, m, mm, c & cpp files. 87 | # For header files it will include any header in the folder. 88 | # Not including the public_header_files will make all headers public. 89 | # 90 | 91 | spec.source_files = "ProgressMaskView" 92 | #, "ProgressMaskView/**/*.{h,m}" 93 | #spec.exclude_files = "Classes/Exclude" 94 | spec.swift_versions = "5.1" 95 | 96 | # spec.public_header_files = "Classes/**/*.h" 97 | 98 | 99 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 100 | # 101 | # A list of resources included with the Pod. These are copied into the 102 | # target bundle with a build phase script. Anything else will be cleaned. 103 | # You can preserve files from being cleaned, please don't preserve 104 | # non-essential files like tests, examples and documentation. 105 | # 106 | 107 | # spec.resource = "icon.png" 108 | # spec.resources = "Resources/*.png" 109 | 110 | # spec.preserve_paths = "FilesToSave", "MoreFilesToSave" 111 | 112 | 113 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 114 | # 115 | # Link your library with frameworks, or libraries. Libraries do not include 116 | # the lib prefix of their name. 117 | # 118 | 119 | # spec.framework = "SomeFramework" 120 | # spec.frameworks = "SomeFramework", "AnotherFramework" 121 | 122 | # spec.library = "iconv" 123 | # spec.libraries = "iconv", "xml2" 124 | 125 | 126 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 127 | # 128 | # If your library depends on compiler flags you can set them in the xcconfig hash 129 | # where they will only apply to your library. If you depend on other Podspecs 130 | # you can include multiple dependencies to ensure it works. 131 | 132 | # spec.requires_arc = true 133 | 134 | # spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 135 | # spec.dependency "JSONKit", "~> 1.4" 136 | 137 | end 138 | -------------------------------------------------------------------------------- /ProgressMaskView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B701D49622DF433B0075107E /* LineArcView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B701D49522DF433B0075107E /* LineArcView.swift */; }; 11 | B7075DAE22E25BE5007C620A /* RotateLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7075DAD22E25BE5007C620A /* RotateLayer.swift */; }; 12 | B70C994623FA2B37003D4595 /* ProgressMaskView.podspec in Resources */ = {isa = PBXBuildFile; fileRef = B70C994523FA2B37003D4595 /* ProgressMaskView.podspec */; }; 13 | B70C994823FA2B6D003D4595 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = B70C994723FA2B6D003D4595 /* LICENSE */; }; 14 | B72F5C0823F64C3D003D0F4B /* ParameterControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72F5C0723F64C3D003D0F4B /* ParameterControlView.swift */; }; 15 | B72F5C0A23F654B1003D0F4B /* SidewayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72F5C0923F654B1003D0F4B /* SidewayView.swift */; }; 16 | B72F5C0F23F67020003D0F4B /* SimpleRView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72F5C0D23F67019003D0F4B /* SimpleRView.swift */; }; 17 | B72F5C1123F67751003D0F4B /* MainTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72F5C1023F67751003D0F4B /* MainTableViewController.swift */; }; 18 | B72F5C1323F67996003D0F4B /* ParameterDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72F5C1223F67996003D0F4B /* ParameterDemoViewController.swift */; }; 19 | B72F5C1623F688F2003D0F4B /* UIColorExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72F5C1523F688F2003D0F4B /* UIColorExtensions.swift */; }; 20 | B72F5C1823F68952003D0F4B /* CGFloatExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72F5C1723F68952003D0F4B /* CGFloatExtensions.swift */; }; 21 | B72F5C1C23F690BB003D0F4B /* BinaryFloatingPointExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72F5C1B23F690BB003D0F4B /* BinaryFloatingPointExtensions.swift */; }; 22 | B72F5C1E23F6E7DF003D0F4B /* UIViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72F5C1D23F6E7DF003D0F4B /* UIViewExtensions.swift */; }; 23 | B73125EB22DA2EC5006D767F /* LineArcRotateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B73125EA22DA2EC5006D767F /* LineArcRotateView.swift */; }; 24 | B73C2F6022DF5B1E005BC4E8 /* ArcShape.swift in Sources */ = {isa = PBXBuildFile; fileRef = B73C2F5F22DF5B1E005BC4E8 /* ArcShape.swift */; }; 25 | B73C2F6222DFB1EA005BC4E8 /* Tools.swift in Sources */ = {isa = PBXBuildFile; fileRef = B73C2F6122DFB1EA005BC4E8 /* Tools.swift */; }; 26 | B74B28BC22D201DC00D111F3 /* ProgressMaskView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B74B28B222D201DC00D111F3 /* ProgressMaskView.framework */; }; 27 | B74B28C122D201DC00D111F3 /* ProgressMaskViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B74B28C022D201DC00D111F3 /* ProgressMaskViewTests.swift */; }; 28 | B74B28C322D201DC00D111F3 /* ProgressMaskView.h in Headers */ = {isa = PBXBuildFile; fileRef = B74B28B522D201DC00D111F3 /* ProgressMaskView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 29 | B74B28CD22D203CC00D111F3 /* ProgressMaskView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B74B28CC22D203CC00D111F3 /* ProgressMaskView.swift */; }; 30 | B74B28D122D2134600D111F3 /* SimpleRView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B74B28D022D2134600D111F3 /* SimpleRView.swift */; }; 31 | B75A93DB23F7AF5600A7712D /* SampleProcess.swift in Sources */ = {isa = PBXBuildFile; fileRef = B75A93DA23F7AF5600A7712D /* SampleProcess.swift */; }; 32 | B7B155E023F51BA300A84799 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7B155DF23F51BA300A84799 /* AppDelegate.swift */; }; 33 | B7B155E223F51BA300A84799 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7B155E123F51BA300A84799 /* SceneDelegate.swift */; }; 34 | B7B155E423F51BA300A84799 /* RandamDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7B155E323F51BA300A84799 /* RandamDemoViewController.swift */; }; 35 | B7B155E723F51BA300A84799 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B7B155E523F51BA300A84799 /* Main.storyboard */; }; 36 | B7B155E923F51BA800A84799 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B7B155E823F51BA800A84799 /* Assets.xcassets */; }; 37 | B7B155EC23F51BA800A84799 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B7B155EA23F51BA800A84799 /* LaunchScreen.storyboard */; }; 38 | B7B155F723F51BA800A84799 /* TestProgressMaskViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7B155F623F51BA800A84799 /* TestProgressMaskViewTests.swift */; }; 39 | B7B1560223F51BA800A84799 /* TestProgressMaskViewUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7B1560123F51BA800A84799 /* TestProgressMaskViewUITests.swift */; }; 40 | B7B1561223F57AAF00A84799 /* ProgressMaskView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B74B28B222D201DC00D111F3 /* ProgressMaskView.framework */; }; 41 | B7B1561323F57AAF00A84799 /* ProgressMaskView.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B74B28B222D201DC00D111F3 /* ProgressMaskView.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 42 | B7B1561623F598CB00A84799 /* ParameterControlView.xib in Resources */ = {isa = PBXBuildFile; fileRef = B7B1561523F598CB00A84799 /* ParameterControlView.xib */; }; 43 | B7B1561823F5991500A84799 /* ProgressMaskBarParameter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7B1561723F5991500A84799 /* ProgressMaskBarParameter.swift */; }; 44 | /* End PBXBuildFile section */ 45 | 46 | /* Begin PBXContainerItemProxy section */ 47 | B74B28BD22D201DC00D111F3 /* PBXContainerItemProxy */ = { 48 | isa = PBXContainerItemProxy; 49 | containerPortal = B74B28A922D201DC00D111F3 /* Project object */; 50 | proxyType = 1; 51 | remoteGlobalIDString = B74B28B122D201DC00D111F3; 52 | remoteInfo = ProgressMaskView; 53 | }; 54 | B7B155F323F51BA800A84799 /* PBXContainerItemProxy */ = { 55 | isa = PBXContainerItemProxy; 56 | containerPortal = B74B28A922D201DC00D111F3 /* Project object */; 57 | proxyType = 1; 58 | remoteGlobalIDString = B7B155DC23F51BA300A84799; 59 | remoteInfo = TestProgressMaskView; 60 | }; 61 | B7B155FE23F51BA800A84799 /* PBXContainerItemProxy */ = { 62 | isa = PBXContainerItemProxy; 63 | containerPortal = B74B28A922D201DC00D111F3 /* Project object */; 64 | proxyType = 1; 65 | remoteGlobalIDString = B7B155DC23F51BA300A84799; 66 | remoteInfo = TestProgressMaskView; 67 | }; 68 | /* End PBXContainerItemProxy section */ 69 | 70 | /* Begin PBXCopyFilesBuildPhase section */ 71 | B7B1561423F57AAF00A84799 /* Embed Frameworks */ = { 72 | isa = PBXCopyFilesBuildPhase; 73 | buildActionMask = 2147483647; 74 | dstPath = ""; 75 | dstSubfolderSpec = 10; 76 | files = ( 77 | B7B1561323F57AAF00A84799 /* ProgressMaskView.framework in Embed Frameworks */, 78 | ); 79 | name = "Embed Frameworks"; 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | /* End PBXCopyFilesBuildPhase section */ 83 | 84 | /* Begin PBXFileReference section */ 85 | B701D49522DF433B0075107E /* LineArcView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineArcView.swift; sourceTree = ""; }; 86 | B7075DAD22E25BE5007C620A /* RotateLayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RotateLayer.swift; sourceTree = ""; }; 87 | B70C994523FA2B37003D4595 /* ProgressMaskView.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ProgressMaskView.podspec; sourceTree = ""; }; 88 | B70C994723FA2B6D003D4595 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 89 | B72F5C0723F64C3D003D0F4B /* ParameterControlView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParameterControlView.swift; sourceTree = ""; }; 90 | B72F5C0923F654B1003D0F4B /* SidewayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidewayView.swift; sourceTree = ""; }; 91 | B72F5C0D23F67019003D0F4B /* SimpleRView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SimpleRView.swift; path = TestProgressMaskViewApp/CommonParts/SimpleRView.swift; sourceTree = SOURCE_ROOT; }; 92 | B72F5C1023F67751003D0F4B /* MainTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTableViewController.swift; sourceTree = ""; }; 93 | B72F5C1223F67996003D0F4B /* ParameterDemoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParameterDemoViewController.swift; sourceTree = ""; }; 94 | B72F5C1523F688F2003D0F4B /* UIColorExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColorExtensions.swift; sourceTree = ""; }; 95 | B72F5C1723F68952003D0F4B /* CGFloatExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGFloatExtensions.swift; sourceTree = ""; }; 96 | B72F5C1B23F690BB003D0F4B /* BinaryFloatingPointExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BinaryFloatingPointExtensions.swift; sourceTree = ""; }; 97 | B72F5C1D23F6E7DF003D0F4B /* UIViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewExtensions.swift; sourceTree = ""; }; 98 | B73125EA22DA2EC5006D767F /* LineArcRotateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineArcRotateView.swift; sourceTree = ""; }; 99 | B73C2F5F22DF5B1E005BC4E8 /* ArcShape.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArcShape.swift; sourceTree = ""; }; 100 | B73C2F6122DFB1EA005BC4E8 /* Tools.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tools.swift; sourceTree = ""; }; 101 | B74B28B222D201DC00D111F3 /* ProgressMaskView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ProgressMaskView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 102 | B74B28B522D201DC00D111F3 /* ProgressMaskView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProgressMaskView.h; sourceTree = ""; }; 103 | B74B28B622D201DC00D111F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 104 | B74B28BB22D201DC00D111F3 /* ProgressMaskViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ProgressMaskViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 105 | B74B28C022D201DC00D111F3 /* ProgressMaskViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressMaskViewTests.swift; sourceTree = ""; }; 106 | B74B28C222D201DC00D111F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 107 | B74B28CC22D203CC00D111F3 /* ProgressMaskView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressMaskView.swift; sourceTree = ""; }; 108 | B74B28D022D2134600D111F3 /* SimpleRView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleRView.swift; sourceTree = ""; }; 109 | B75A93DA23F7AF5600A7712D /* SampleProcess.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleProcess.swift; sourceTree = ""; }; 110 | B761636322E5148D00FC3D07 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 111 | B7B155DD23F51BA300A84799 /* TestProgressMaskViewApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestProgressMaskViewApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 112 | B7B155DF23F51BA300A84799 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 113 | B7B155E123F51BA300A84799 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 114 | B7B155E323F51BA300A84799 /* RandamDemoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RandamDemoViewController.swift; sourceTree = ""; }; 115 | B7B155E623F51BA300A84799 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 116 | B7B155E823F51BA800A84799 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 117 | B7B155EB23F51BA800A84799 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 118 | B7B155ED23F51BA800A84799 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 119 | B7B155F223F51BA800A84799 /* TestProgressMaskViewAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestProgressMaskViewAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 120 | B7B155F623F51BA800A84799 /* TestProgressMaskViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestProgressMaskViewTests.swift; sourceTree = ""; }; 121 | B7B155F823F51BA800A84799 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 122 | B7B155FD23F51BA800A84799 /* TestProgressMaskViewAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestProgressMaskViewAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 123 | B7B1560123F51BA800A84799 /* TestProgressMaskViewUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestProgressMaskViewUITests.swift; sourceTree = ""; }; 124 | B7B1560323F51BA800A84799 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 125 | B7B1561523F598CB00A84799 /* ParameterControlView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ParameterControlView.xib; sourceTree = ""; }; 126 | B7B1561723F5991500A84799 /* ProgressMaskBarParameter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressMaskBarParameter.swift; sourceTree = ""; }; 127 | /* End PBXFileReference section */ 128 | 129 | /* Begin PBXFrameworksBuildPhase section */ 130 | B74B28AF22D201DC00D111F3 /* Frameworks */ = { 131 | isa = PBXFrameworksBuildPhase; 132 | buildActionMask = 2147483647; 133 | files = ( 134 | ); 135 | runOnlyForDeploymentPostprocessing = 0; 136 | }; 137 | B74B28B822D201DC00D111F3 /* Frameworks */ = { 138 | isa = PBXFrameworksBuildPhase; 139 | buildActionMask = 2147483647; 140 | files = ( 141 | B74B28BC22D201DC00D111F3 /* ProgressMaskView.framework in Frameworks */, 142 | ); 143 | runOnlyForDeploymentPostprocessing = 0; 144 | }; 145 | B7B155DA23F51BA300A84799 /* Frameworks */ = { 146 | isa = PBXFrameworksBuildPhase; 147 | buildActionMask = 2147483647; 148 | files = ( 149 | B7B1561223F57AAF00A84799 /* ProgressMaskView.framework in Frameworks */, 150 | ); 151 | runOnlyForDeploymentPostprocessing = 0; 152 | }; 153 | B7B155EF23F51BA800A84799 /* Frameworks */ = { 154 | isa = PBXFrameworksBuildPhase; 155 | buildActionMask = 2147483647; 156 | files = ( 157 | ); 158 | runOnlyForDeploymentPostprocessing = 0; 159 | }; 160 | B7B155FA23F51BA800A84799 /* Frameworks */ = { 161 | isa = PBXFrameworksBuildPhase; 162 | buildActionMask = 2147483647; 163 | files = ( 164 | ); 165 | runOnlyForDeploymentPostprocessing = 0; 166 | }; 167 | /* End PBXFrameworksBuildPhase section */ 168 | 169 | /* Begin PBXGroup section */ 170 | B72F5C1423F688DE003D0F4B /* Extensions */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | B72F5C1523F688F2003D0F4B /* UIColorExtensions.swift */, 174 | B72F5C1723F68952003D0F4B /* CGFloatExtensions.swift */, 175 | B72F5C1B23F690BB003D0F4B /* BinaryFloatingPointExtensions.swift */, 176 | B72F5C1D23F6E7DF003D0F4B /* UIViewExtensions.swift */, 177 | ); 178 | path = Extensions; 179 | sourceTree = ""; 180 | }; 181 | B72F5C2023F6F7BE003D0F4B /* CommonParts */ = { 182 | isa = PBXGroup; 183 | children = ( 184 | B72F5C0D23F67019003D0F4B /* SimpleRView.swift */, 185 | B72F5C0923F654B1003D0F4B /* SidewayView.swift */, 186 | B7B1561523F598CB00A84799 /* ParameterControlView.xib */, 187 | B72F5C0723F64C3D003D0F4B /* ParameterControlView.swift */, 188 | ); 189 | path = CommonParts; 190 | sourceTree = ""; 191 | }; 192 | B74B28A822D201DC00D111F3 = { 193 | isa = PBXGroup; 194 | children = ( 195 | B761636322E5148D00FC3D07 /* README.md */, 196 | B70C994723FA2B6D003D4595 /* LICENSE */, 197 | B70C994523FA2B37003D4595 /* ProgressMaskView.podspec */, 198 | B74B28B422D201DC00D111F3 /* ProgressMaskView */, 199 | B74B28BF22D201DC00D111F3 /* ProgressMaskViewTests */, 200 | B7B155DE23F51BA300A84799 /* TestProgressMaskViewApp */, 201 | B7B155F523F51BA800A84799 /* TestProgressMaskViewAppTests */, 202 | B7B1560023F51BA800A84799 /* TestProgressMaskViewAppUITests */, 203 | B74B28B322D201DC00D111F3 /* Products */, 204 | B7B1560E23F5677900A84799 /* Frameworks */, 205 | ); 206 | sourceTree = ""; 207 | }; 208 | B74B28B322D201DC00D111F3 /* Products */ = { 209 | isa = PBXGroup; 210 | children = ( 211 | B74B28B222D201DC00D111F3 /* ProgressMaskView.framework */, 212 | B74B28BB22D201DC00D111F3 /* ProgressMaskViewTests.xctest */, 213 | B7B155DD23F51BA300A84799 /* TestProgressMaskViewApp.app */, 214 | B7B155F223F51BA800A84799 /* TestProgressMaskViewAppTests.xctest */, 215 | B7B155FD23F51BA800A84799 /* TestProgressMaskViewAppUITests.xctest */, 216 | ); 217 | name = Products; 218 | sourceTree = ""; 219 | }; 220 | B74B28B422D201DC00D111F3 /* ProgressMaskView */ = { 221 | isa = PBXGroup; 222 | children = ( 223 | B74B28B522D201DC00D111F3 /* ProgressMaskView.h */, 224 | B74B28CC22D203CC00D111F3 /* ProgressMaskView.swift */, 225 | B7B1561723F5991500A84799 /* ProgressMaskBarParameter.swift */, 226 | B73125EA22DA2EC5006D767F /* LineArcRotateView.swift */, 227 | B701D49522DF433B0075107E /* LineArcView.swift */, 228 | B7075DAD22E25BE5007C620A /* RotateLayer.swift */, 229 | B73C2F5F22DF5B1E005BC4E8 /* ArcShape.swift */, 230 | B74B28D022D2134600D111F3 /* SimpleRView.swift */, 231 | B73C2F6122DFB1EA005BC4E8 /* Tools.swift */, 232 | B74B28B622D201DC00D111F3 /* Info.plist */, 233 | ); 234 | path = ProgressMaskView; 235 | sourceTree = ""; 236 | }; 237 | B74B28BF22D201DC00D111F3 /* ProgressMaskViewTests */ = { 238 | isa = PBXGroup; 239 | children = ( 240 | B74B28C022D201DC00D111F3 /* ProgressMaskViewTests.swift */, 241 | B74B28C222D201DC00D111F3 /* Info.plist */, 242 | ); 243 | path = ProgressMaskViewTests; 244 | sourceTree = ""; 245 | }; 246 | B7B155DE23F51BA300A84799 /* TestProgressMaskViewApp */ = { 247 | isa = PBXGroup; 248 | children = ( 249 | B72F5C1423F688DE003D0F4B /* Extensions */, 250 | B72F5C2023F6F7BE003D0F4B /* CommonParts */, 251 | B7B155DF23F51BA300A84799 /* AppDelegate.swift */, 252 | B7B155E123F51BA300A84799 /* SceneDelegate.swift */, 253 | B7B155E523F51BA300A84799 /* Main.storyboard */, 254 | B72F5C1023F67751003D0F4B /* MainTableViewController.swift */, 255 | B7B155E323F51BA300A84799 /* RandamDemoViewController.swift */, 256 | B72F5C1223F67996003D0F4B /* ParameterDemoViewController.swift */, 257 | B75A93DA23F7AF5600A7712D /* SampleProcess.swift */, 258 | B7B155E823F51BA800A84799 /* Assets.xcassets */, 259 | B7B155EA23F51BA800A84799 /* LaunchScreen.storyboard */, 260 | B7B155ED23F51BA800A84799 /* Info.plist */, 261 | ); 262 | path = TestProgressMaskViewApp; 263 | sourceTree = ""; 264 | }; 265 | B7B155F523F51BA800A84799 /* TestProgressMaskViewAppTests */ = { 266 | isa = PBXGroup; 267 | children = ( 268 | B7B155F623F51BA800A84799 /* TestProgressMaskViewTests.swift */, 269 | B7B155F823F51BA800A84799 /* Info.plist */, 270 | ); 271 | path = TestProgressMaskViewAppTests; 272 | sourceTree = ""; 273 | }; 274 | B7B1560023F51BA800A84799 /* TestProgressMaskViewAppUITests */ = { 275 | isa = PBXGroup; 276 | children = ( 277 | B7B1560123F51BA800A84799 /* TestProgressMaskViewUITests.swift */, 278 | B7B1560323F51BA800A84799 /* Info.plist */, 279 | ); 280 | path = TestProgressMaskViewAppUITests; 281 | sourceTree = ""; 282 | }; 283 | B7B1560E23F5677900A84799 /* Frameworks */ = { 284 | isa = PBXGroup; 285 | children = ( 286 | ); 287 | name = Frameworks; 288 | sourceTree = ""; 289 | }; 290 | /* End PBXGroup section */ 291 | 292 | /* Begin PBXHeadersBuildPhase section */ 293 | B74B28AD22D201DC00D111F3 /* Headers */ = { 294 | isa = PBXHeadersBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | B74B28C322D201DC00D111F3 /* ProgressMaskView.h in Headers */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | /* End PBXHeadersBuildPhase section */ 302 | 303 | /* Begin PBXNativeTarget section */ 304 | B74B28B122D201DC00D111F3 /* ProgressMaskView */ = { 305 | isa = PBXNativeTarget; 306 | buildConfigurationList = B74B28C622D201DC00D111F3 /* Build configuration list for PBXNativeTarget "ProgressMaskView" */; 307 | buildPhases = ( 308 | B74B28AD22D201DC00D111F3 /* Headers */, 309 | B74B28AE22D201DC00D111F3 /* Sources */, 310 | B74B28AF22D201DC00D111F3 /* Frameworks */, 311 | B74B28B022D201DC00D111F3 /* Resources */, 312 | ); 313 | buildRules = ( 314 | ); 315 | dependencies = ( 316 | ); 317 | name = ProgressMaskView; 318 | productName = ProgressMaskView; 319 | productReference = B74B28B222D201DC00D111F3 /* ProgressMaskView.framework */; 320 | productType = "com.apple.product-type.framework"; 321 | }; 322 | B74B28BA22D201DC00D111F3 /* ProgressMaskViewTests */ = { 323 | isa = PBXNativeTarget; 324 | buildConfigurationList = B74B28C922D201DC00D111F3 /* Build configuration list for PBXNativeTarget "ProgressMaskViewTests" */; 325 | buildPhases = ( 326 | B74B28B722D201DC00D111F3 /* Sources */, 327 | B74B28B822D201DC00D111F3 /* Frameworks */, 328 | B74B28B922D201DC00D111F3 /* Resources */, 329 | ); 330 | buildRules = ( 331 | ); 332 | dependencies = ( 333 | B74B28BE22D201DC00D111F3 /* PBXTargetDependency */, 334 | ); 335 | name = ProgressMaskViewTests; 336 | productName = ProgressMaskViewTests; 337 | productReference = B74B28BB22D201DC00D111F3 /* ProgressMaskViewTests.xctest */; 338 | productType = "com.apple.product-type.bundle.unit-test"; 339 | }; 340 | B7B155DC23F51BA300A84799 /* TestProgressMaskViewApp */ = { 341 | isa = PBXNativeTarget; 342 | buildConfigurationList = B7B1560A23F51BA800A84799 /* Build configuration list for PBXNativeTarget "TestProgressMaskViewApp" */; 343 | buildPhases = ( 344 | B7B155D923F51BA300A84799 /* Sources */, 345 | B7B155DA23F51BA300A84799 /* Frameworks */, 346 | B7B155DB23F51BA300A84799 /* Resources */, 347 | B7B1561423F57AAF00A84799 /* Embed Frameworks */, 348 | ); 349 | buildRules = ( 350 | ); 351 | dependencies = ( 352 | ); 353 | name = TestProgressMaskViewApp; 354 | productName = TestProgressMaskView; 355 | productReference = B7B155DD23F51BA300A84799 /* TestProgressMaskViewApp.app */; 356 | productType = "com.apple.product-type.application"; 357 | }; 358 | B7B155F123F51BA800A84799 /* TestProgressMaskViewAppTests */ = { 359 | isa = PBXNativeTarget; 360 | buildConfigurationList = B7B1560B23F51BA800A84799 /* Build configuration list for PBXNativeTarget "TestProgressMaskViewAppTests" */; 361 | buildPhases = ( 362 | B7B155EE23F51BA800A84799 /* Sources */, 363 | B7B155EF23F51BA800A84799 /* Frameworks */, 364 | B7B155F023F51BA800A84799 /* Resources */, 365 | ); 366 | buildRules = ( 367 | ); 368 | dependencies = ( 369 | B7B155F423F51BA800A84799 /* PBXTargetDependency */, 370 | ); 371 | name = TestProgressMaskViewAppTests; 372 | productName = TestProgressMaskViewTests; 373 | productReference = B7B155F223F51BA800A84799 /* TestProgressMaskViewAppTests.xctest */; 374 | productType = "com.apple.product-type.bundle.unit-test"; 375 | }; 376 | B7B155FC23F51BA800A84799 /* TestProgressMaskViewAppUITests */ = { 377 | isa = PBXNativeTarget; 378 | buildConfigurationList = B7B1560C23F51BA800A84799 /* Build configuration list for PBXNativeTarget "TestProgressMaskViewAppUITests" */; 379 | buildPhases = ( 380 | B7B155F923F51BA800A84799 /* Sources */, 381 | B7B155FA23F51BA800A84799 /* Frameworks */, 382 | B7B155FB23F51BA800A84799 /* Resources */, 383 | ); 384 | buildRules = ( 385 | ); 386 | dependencies = ( 387 | B7B155FF23F51BA800A84799 /* PBXTargetDependency */, 388 | ); 389 | name = TestProgressMaskViewAppUITests; 390 | productName = TestProgressMaskViewUITests; 391 | productReference = B7B155FD23F51BA800A84799 /* TestProgressMaskViewAppUITests.xctest */; 392 | productType = "com.apple.product-type.bundle.ui-testing"; 393 | }; 394 | /* End PBXNativeTarget section */ 395 | 396 | /* Begin PBXProject section */ 397 | B74B28A922D201DC00D111F3 /* Project object */ = { 398 | isa = PBXProject; 399 | attributes = { 400 | LastSwiftUpdateCheck = 1130; 401 | LastUpgradeCheck = 1020; 402 | ORGANIZATIONNAME = "Yu Software"; 403 | TargetAttributes = { 404 | B74B28B122D201DC00D111F3 = { 405 | CreatedOnToolsVersion = 10.2.1; 406 | LastSwiftMigration = 1020; 407 | }; 408 | B74B28BA22D201DC00D111F3 = { 409 | CreatedOnToolsVersion = 10.2.1; 410 | }; 411 | B7B155DC23F51BA300A84799 = { 412 | CreatedOnToolsVersion = 11.3.1; 413 | }; 414 | B7B155F123F51BA800A84799 = { 415 | CreatedOnToolsVersion = 11.3.1; 416 | TestTargetID = B7B155DC23F51BA300A84799; 417 | }; 418 | B7B155FC23F51BA800A84799 = { 419 | CreatedOnToolsVersion = 11.3.1; 420 | TestTargetID = B7B155DC23F51BA300A84799; 421 | }; 422 | }; 423 | }; 424 | buildConfigurationList = B74B28AC22D201DC00D111F3 /* Build configuration list for PBXProject "ProgressMaskView" */; 425 | compatibilityVersion = "Xcode 9.3"; 426 | developmentRegion = en; 427 | hasScannedForEncodings = 0; 428 | knownRegions = ( 429 | en, 430 | Base, 431 | ); 432 | mainGroup = B74B28A822D201DC00D111F3; 433 | productRefGroup = B74B28B322D201DC00D111F3 /* Products */; 434 | projectDirPath = ""; 435 | projectRoot = ""; 436 | targets = ( 437 | B74B28B122D201DC00D111F3 /* ProgressMaskView */, 438 | B74B28BA22D201DC00D111F3 /* ProgressMaskViewTests */, 439 | B7B155DC23F51BA300A84799 /* TestProgressMaskViewApp */, 440 | B7B155F123F51BA800A84799 /* TestProgressMaskViewAppTests */, 441 | B7B155FC23F51BA800A84799 /* TestProgressMaskViewAppUITests */, 442 | ); 443 | }; 444 | /* End PBXProject section */ 445 | 446 | /* Begin PBXResourcesBuildPhase section */ 447 | B74B28B022D201DC00D111F3 /* Resources */ = { 448 | isa = PBXResourcesBuildPhase; 449 | buildActionMask = 2147483647; 450 | files = ( 451 | B70C994823FA2B6D003D4595 /* LICENSE in Resources */, 452 | B70C994623FA2B37003D4595 /* ProgressMaskView.podspec in Resources */, 453 | ); 454 | runOnlyForDeploymentPostprocessing = 0; 455 | }; 456 | B74B28B922D201DC00D111F3 /* Resources */ = { 457 | isa = PBXResourcesBuildPhase; 458 | buildActionMask = 2147483647; 459 | files = ( 460 | ); 461 | runOnlyForDeploymentPostprocessing = 0; 462 | }; 463 | B7B155DB23F51BA300A84799 /* Resources */ = { 464 | isa = PBXResourcesBuildPhase; 465 | buildActionMask = 2147483647; 466 | files = ( 467 | B7B155EC23F51BA800A84799 /* LaunchScreen.storyboard in Resources */, 468 | B7B155E923F51BA800A84799 /* Assets.xcassets in Resources */, 469 | B7B1561623F598CB00A84799 /* ParameterControlView.xib in Resources */, 470 | B7B155E723F51BA300A84799 /* Main.storyboard in Resources */, 471 | ); 472 | runOnlyForDeploymentPostprocessing = 0; 473 | }; 474 | B7B155F023F51BA800A84799 /* Resources */ = { 475 | isa = PBXResourcesBuildPhase; 476 | buildActionMask = 2147483647; 477 | files = ( 478 | ); 479 | runOnlyForDeploymentPostprocessing = 0; 480 | }; 481 | B7B155FB23F51BA800A84799 /* Resources */ = { 482 | isa = PBXResourcesBuildPhase; 483 | buildActionMask = 2147483647; 484 | files = ( 485 | ); 486 | runOnlyForDeploymentPostprocessing = 0; 487 | }; 488 | /* End PBXResourcesBuildPhase section */ 489 | 490 | /* Begin PBXSourcesBuildPhase section */ 491 | B74B28AE22D201DC00D111F3 /* Sources */ = { 492 | isa = PBXSourcesBuildPhase; 493 | buildActionMask = 2147483647; 494 | files = ( 495 | B7B1561823F5991500A84799 /* ProgressMaskBarParameter.swift in Sources */, 496 | B73125EB22DA2EC5006D767F /* LineArcRotateView.swift in Sources */, 497 | B701D49622DF433B0075107E /* LineArcView.swift in Sources */, 498 | B74B28CD22D203CC00D111F3 /* ProgressMaskView.swift in Sources */, 499 | B7075DAE22E25BE5007C620A /* RotateLayer.swift in Sources */, 500 | B73C2F6222DFB1EA005BC4E8 /* Tools.swift in Sources */, 501 | B74B28D122D2134600D111F3 /* SimpleRView.swift in Sources */, 502 | B73C2F6022DF5B1E005BC4E8 /* ArcShape.swift in Sources */, 503 | ); 504 | runOnlyForDeploymentPostprocessing = 0; 505 | }; 506 | B74B28B722D201DC00D111F3 /* Sources */ = { 507 | isa = PBXSourcesBuildPhase; 508 | buildActionMask = 2147483647; 509 | files = ( 510 | B74B28C122D201DC00D111F3 /* ProgressMaskViewTests.swift in Sources */, 511 | ); 512 | runOnlyForDeploymentPostprocessing = 0; 513 | }; 514 | B7B155D923F51BA300A84799 /* Sources */ = { 515 | isa = PBXSourcesBuildPhase; 516 | buildActionMask = 2147483647; 517 | files = ( 518 | B72F5C1623F688F2003D0F4B /* UIColorExtensions.swift in Sources */, 519 | B7B155E423F51BA300A84799 /* RandamDemoViewController.swift in Sources */, 520 | B7B155E023F51BA300A84799 /* AppDelegate.swift in Sources */, 521 | B72F5C0823F64C3D003D0F4B /* ParameterControlView.swift in Sources */, 522 | B72F5C1823F68952003D0F4B /* CGFloatExtensions.swift in Sources */, 523 | B72F5C1323F67996003D0F4B /* ParameterDemoViewController.swift in Sources */, 524 | B7B155E223F51BA300A84799 /* SceneDelegate.swift in Sources */, 525 | B72F5C0A23F654B1003D0F4B /* SidewayView.swift in Sources */, 526 | B72F5C0F23F67020003D0F4B /* SimpleRView.swift in Sources */, 527 | B72F5C1123F67751003D0F4B /* MainTableViewController.swift in Sources */, 528 | B75A93DB23F7AF5600A7712D /* SampleProcess.swift in Sources */, 529 | B72F5C1E23F6E7DF003D0F4B /* UIViewExtensions.swift in Sources */, 530 | B72F5C1C23F690BB003D0F4B /* BinaryFloatingPointExtensions.swift in Sources */, 531 | ); 532 | runOnlyForDeploymentPostprocessing = 0; 533 | }; 534 | B7B155EE23F51BA800A84799 /* Sources */ = { 535 | isa = PBXSourcesBuildPhase; 536 | buildActionMask = 2147483647; 537 | files = ( 538 | B7B155F723F51BA800A84799 /* TestProgressMaskViewTests.swift in Sources */, 539 | ); 540 | runOnlyForDeploymentPostprocessing = 0; 541 | }; 542 | B7B155F923F51BA800A84799 /* Sources */ = { 543 | isa = PBXSourcesBuildPhase; 544 | buildActionMask = 2147483647; 545 | files = ( 546 | B7B1560223F51BA800A84799 /* TestProgressMaskViewUITests.swift in Sources */, 547 | ); 548 | runOnlyForDeploymentPostprocessing = 0; 549 | }; 550 | /* End PBXSourcesBuildPhase section */ 551 | 552 | /* Begin PBXTargetDependency section */ 553 | B74B28BE22D201DC00D111F3 /* PBXTargetDependency */ = { 554 | isa = PBXTargetDependency; 555 | target = B74B28B122D201DC00D111F3 /* ProgressMaskView */; 556 | targetProxy = B74B28BD22D201DC00D111F3 /* PBXContainerItemProxy */; 557 | }; 558 | B7B155F423F51BA800A84799 /* PBXTargetDependency */ = { 559 | isa = PBXTargetDependency; 560 | target = B7B155DC23F51BA300A84799 /* TestProgressMaskViewApp */; 561 | targetProxy = B7B155F323F51BA800A84799 /* PBXContainerItemProxy */; 562 | }; 563 | B7B155FF23F51BA800A84799 /* PBXTargetDependency */ = { 564 | isa = PBXTargetDependency; 565 | target = B7B155DC23F51BA300A84799 /* TestProgressMaskViewApp */; 566 | targetProxy = B7B155FE23F51BA800A84799 /* PBXContainerItemProxy */; 567 | }; 568 | /* End PBXTargetDependency section */ 569 | 570 | /* Begin PBXVariantGroup section */ 571 | B7B155E523F51BA300A84799 /* Main.storyboard */ = { 572 | isa = PBXVariantGroup; 573 | children = ( 574 | B7B155E623F51BA300A84799 /* Base */, 575 | ); 576 | name = Main.storyboard; 577 | sourceTree = ""; 578 | }; 579 | B7B155EA23F51BA800A84799 /* LaunchScreen.storyboard */ = { 580 | isa = PBXVariantGroup; 581 | children = ( 582 | B7B155EB23F51BA800A84799 /* Base */, 583 | ); 584 | name = LaunchScreen.storyboard; 585 | sourceTree = ""; 586 | }; 587 | /* End PBXVariantGroup section */ 588 | 589 | /* Begin XCBuildConfiguration section */ 590 | B74B28C422D201DC00D111F3 /* Debug */ = { 591 | isa = XCBuildConfiguration; 592 | buildSettings = { 593 | ALWAYS_SEARCH_USER_PATHS = NO; 594 | CLANG_ANALYZER_NONNULL = YES; 595 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 596 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 597 | CLANG_CXX_LIBRARY = "libc++"; 598 | CLANG_ENABLE_MODULES = YES; 599 | CLANG_ENABLE_OBJC_ARC = YES; 600 | CLANG_ENABLE_OBJC_WEAK = YES; 601 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 602 | CLANG_WARN_BOOL_CONVERSION = YES; 603 | CLANG_WARN_COMMA = YES; 604 | CLANG_WARN_CONSTANT_CONVERSION = YES; 605 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 606 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 607 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 608 | CLANG_WARN_EMPTY_BODY = YES; 609 | CLANG_WARN_ENUM_CONVERSION = YES; 610 | CLANG_WARN_INFINITE_RECURSION = YES; 611 | CLANG_WARN_INT_CONVERSION = YES; 612 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 613 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 614 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 615 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 616 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 617 | CLANG_WARN_STRICT_PROTOTYPES = YES; 618 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 619 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 620 | CLANG_WARN_UNREACHABLE_CODE = YES; 621 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 622 | CODE_SIGN_IDENTITY = "iPhone Developer"; 623 | COPY_PHASE_STRIP = NO; 624 | CURRENT_PROJECT_VERSION = 1; 625 | DEBUG_INFORMATION_FORMAT = dwarf; 626 | ENABLE_STRICT_OBJC_MSGSEND = YES; 627 | ENABLE_TESTABILITY = YES; 628 | GCC_C_LANGUAGE_STANDARD = gnu11; 629 | GCC_DYNAMIC_NO_PIC = NO; 630 | GCC_NO_COMMON_BLOCKS = YES; 631 | GCC_OPTIMIZATION_LEVEL = 0; 632 | GCC_PREPROCESSOR_DEFINITIONS = ( 633 | "DEBUG=1", 634 | "$(inherited)", 635 | ); 636 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 637 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 638 | GCC_WARN_UNDECLARED_SELECTOR = YES; 639 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 640 | GCC_WARN_UNUSED_FUNCTION = YES; 641 | GCC_WARN_UNUSED_VARIABLE = YES; 642 | IPHONEOS_DEPLOYMENT_TARGET = 12.2; 643 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 644 | MTL_FAST_MATH = YES; 645 | ONLY_ACTIVE_ARCH = YES; 646 | SDKROOT = iphoneos; 647 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 648 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 649 | VERSIONING_SYSTEM = "apple-generic"; 650 | VERSION_INFO_PREFIX = ""; 651 | }; 652 | name = Debug; 653 | }; 654 | B74B28C522D201DC00D111F3 /* Release */ = { 655 | isa = XCBuildConfiguration; 656 | buildSettings = { 657 | ALWAYS_SEARCH_USER_PATHS = NO; 658 | CLANG_ANALYZER_NONNULL = YES; 659 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 660 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 661 | CLANG_CXX_LIBRARY = "libc++"; 662 | CLANG_ENABLE_MODULES = YES; 663 | CLANG_ENABLE_OBJC_ARC = YES; 664 | CLANG_ENABLE_OBJC_WEAK = YES; 665 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 666 | CLANG_WARN_BOOL_CONVERSION = YES; 667 | CLANG_WARN_COMMA = YES; 668 | CLANG_WARN_CONSTANT_CONVERSION = YES; 669 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 670 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 671 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 672 | CLANG_WARN_EMPTY_BODY = YES; 673 | CLANG_WARN_ENUM_CONVERSION = YES; 674 | CLANG_WARN_INFINITE_RECURSION = YES; 675 | CLANG_WARN_INT_CONVERSION = YES; 676 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 677 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 678 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 679 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 680 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 681 | CLANG_WARN_STRICT_PROTOTYPES = YES; 682 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 683 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 684 | CLANG_WARN_UNREACHABLE_CODE = YES; 685 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 686 | CODE_SIGN_IDENTITY = "iPhone Developer"; 687 | COPY_PHASE_STRIP = NO; 688 | CURRENT_PROJECT_VERSION = 1; 689 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 690 | ENABLE_NS_ASSERTIONS = NO; 691 | ENABLE_STRICT_OBJC_MSGSEND = YES; 692 | GCC_C_LANGUAGE_STANDARD = gnu11; 693 | GCC_NO_COMMON_BLOCKS = YES; 694 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 695 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 696 | GCC_WARN_UNDECLARED_SELECTOR = YES; 697 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 698 | GCC_WARN_UNUSED_FUNCTION = YES; 699 | GCC_WARN_UNUSED_VARIABLE = YES; 700 | IPHONEOS_DEPLOYMENT_TARGET = 12.2; 701 | MTL_ENABLE_DEBUG_INFO = NO; 702 | MTL_FAST_MATH = YES; 703 | SDKROOT = iphoneos; 704 | SWIFT_COMPILATION_MODE = wholemodule; 705 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 706 | VALIDATE_PRODUCT = YES; 707 | VERSIONING_SYSTEM = "apple-generic"; 708 | VERSION_INFO_PREFIX = ""; 709 | }; 710 | name = Release; 711 | }; 712 | B74B28C722D201DC00D111F3 /* Debug */ = { 713 | isa = XCBuildConfiguration; 714 | buildSettings = { 715 | CLANG_ENABLE_MODULES = YES; 716 | CODE_SIGN_IDENTITY = ""; 717 | CODE_SIGN_STYLE = Automatic; 718 | DEFINES_MODULE = YES; 719 | DEVELOPMENT_TEAM = NUGY3GPKNT; 720 | DYLIB_COMPATIBILITY_VERSION = 1; 721 | DYLIB_CURRENT_VERSION = 1; 722 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 723 | INFOPLIST_FILE = ProgressMaskView/Info.plist; 724 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 725 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 726 | LD_RUNPATH_SEARCH_PATHS = ( 727 | "$(inherited)", 728 | "@executable_path/Frameworks", 729 | "@loader_path/Frameworks", 730 | ); 731 | PRODUCT_BUNDLE_IDENTIFIER = net.yusoftware.ProgressMaskView; 732 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 733 | SKIP_INSTALL = YES; 734 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 735 | SWIFT_VERSION = 5.0; 736 | TARGETED_DEVICE_FAMILY = "1,2"; 737 | }; 738 | name = Debug; 739 | }; 740 | B74B28C822D201DC00D111F3 /* Release */ = { 741 | isa = XCBuildConfiguration; 742 | buildSettings = { 743 | CLANG_ENABLE_MODULES = YES; 744 | CODE_SIGN_IDENTITY = ""; 745 | CODE_SIGN_STYLE = Automatic; 746 | DEFINES_MODULE = YES; 747 | DEVELOPMENT_TEAM = NUGY3GPKNT; 748 | DYLIB_COMPATIBILITY_VERSION = 1; 749 | DYLIB_CURRENT_VERSION = 1; 750 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 751 | INFOPLIST_FILE = ProgressMaskViewApp/Info.plist; 752 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 753 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 754 | LD_RUNPATH_SEARCH_PATHS = ( 755 | "$(inherited)", 756 | "@executable_path/Frameworks", 757 | "@loader_path/Frameworks", 758 | ); 759 | PRODUCT_BUNDLE_IDENTIFIER = net.yusoftware.ProgressMaskView; 760 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 761 | SKIP_INSTALL = YES; 762 | SWIFT_VERSION = 5.0; 763 | TARGETED_DEVICE_FAMILY = "1,2"; 764 | }; 765 | name = Release; 766 | }; 767 | B74B28CA22D201DC00D111F3 /* Debug */ = { 768 | isa = XCBuildConfiguration; 769 | buildSettings = { 770 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 771 | CODE_SIGN_STYLE = Automatic; 772 | DEVELOPMENT_TEAM = NUGY3GPKNT; 773 | INFOPLIST_FILE = ProgressMaskViewTests/Info.plist; 774 | LD_RUNPATH_SEARCH_PATHS = ( 775 | "$(inherited)", 776 | "@executable_path/Frameworks", 777 | "@loader_path/Frameworks", 778 | ); 779 | PRODUCT_BUNDLE_IDENTIFIER = net.yusoftware.ProgressMaskViewTests; 780 | PRODUCT_NAME = "$(TARGET_NAME)"; 781 | SWIFT_VERSION = 5.0; 782 | TARGETED_DEVICE_FAMILY = "1,2"; 783 | }; 784 | name = Debug; 785 | }; 786 | B74B28CB22D201DC00D111F3 /* Release */ = { 787 | isa = XCBuildConfiguration; 788 | buildSettings = { 789 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 790 | CODE_SIGN_STYLE = Automatic; 791 | DEVELOPMENT_TEAM = NUGY3GPKNT; 792 | INFOPLIST_FILE = ProgressMaskViewAppTests/Info.plist; 793 | LD_RUNPATH_SEARCH_PATHS = ( 794 | "$(inherited)", 795 | "@executable_path/Frameworks", 796 | "@loader_path/Frameworks", 797 | ); 798 | PRODUCT_BUNDLE_IDENTIFIER = net.yusoftware.ProgressMaskViewTests; 799 | PRODUCT_NAME = "$(TARGET_NAME)"; 800 | SWIFT_VERSION = 5.0; 801 | TARGETED_DEVICE_FAMILY = "1,2"; 802 | }; 803 | name = Release; 804 | }; 805 | B7B1560423F51BA800A84799 /* Debug */ = { 806 | isa = XCBuildConfiguration; 807 | buildSettings = { 808 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 809 | CODE_SIGN_STYLE = Automatic; 810 | DEVELOPMENT_TEAM = R9A97CK9U4; 811 | INFOPLIST_FILE = TestProgressMaskViewApp/Info.plist; 812 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 813 | LD_RUNPATH_SEARCH_PATHS = ( 814 | "$(inherited)", 815 | "@executable_path/Frameworks", 816 | ); 817 | PRODUCT_BUNDLE_IDENTIFIER = com.github.eytyet.TestProgressMaskView; 818 | PRODUCT_NAME = "$(TARGET_NAME)"; 819 | SWIFT_VERSION = 5.0; 820 | TARGETED_DEVICE_FAMILY = "1,2"; 821 | }; 822 | name = Debug; 823 | }; 824 | B7B1560523F51BA800A84799 /* Release */ = { 825 | isa = XCBuildConfiguration; 826 | buildSettings = { 827 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 828 | CODE_SIGN_STYLE = Automatic; 829 | DEVELOPMENT_TEAM = R9A97CK9U4; 830 | INFOPLIST_FILE = TestProgressMaskViewApp/Info.plist; 831 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 832 | LD_RUNPATH_SEARCH_PATHS = ( 833 | "$(inherited)", 834 | "@executable_path/Frameworks", 835 | ); 836 | PRODUCT_BUNDLE_IDENTIFIER = com.github.eytyet.TestProgressMaskView; 837 | PRODUCT_NAME = "$(TARGET_NAME)"; 838 | SWIFT_VERSION = 5.0; 839 | TARGETED_DEVICE_FAMILY = "1,2"; 840 | }; 841 | name = Release; 842 | }; 843 | B7B1560623F51BA800A84799 /* Debug */ = { 844 | isa = XCBuildConfiguration; 845 | buildSettings = { 846 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 847 | BUNDLE_LOADER = "$(TEST_HOST)"; 848 | CODE_SIGN_STYLE = Automatic; 849 | DEVELOPMENT_TEAM = R9A97CK9U4; 850 | INFOPLIST_FILE = TestProgressMaskViewAppTests/Info.plist; 851 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 852 | LD_RUNPATH_SEARCH_PATHS = ( 853 | "$(inherited)", 854 | "@executable_path/Frameworks", 855 | "@loader_path/Frameworks", 856 | ); 857 | PRODUCT_BUNDLE_IDENTIFIER = com.github.eytyet.TestProgressMaskViewTests; 858 | PRODUCT_NAME = "$(TARGET_NAME)"; 859 | SWIFT_VERSION = 5.0; 860 | TARGETED_DEVICE_FAMILY = "1,2"; 861 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestProgressMaskView.app/TestProgressMaskView"; 862 | }; 863 | name = Debug; 864 | }; 865 | B7B1560723F51BA800A84799 /* Release */ = { 866 | isa = XCBuildConfiguration; 867 | buildSettings = { 868 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 869 | BUNDLE_LOADER = "$(TEST_HOST)"; 870 | CODE_SIGN_STYLE = Automatic; 871 | DEVELOPMENT_TEAM = R9A97CK9U4; 872 | INFOPLIST_FILE = TestProgressMaskViewAppTests/Info.plist; 873 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 874 | LD_RUNPATH_SEARCH_PATHS = ( 875 | "$(inherited)", 876 | "@executable_path/Frameworks", 877 | "@loader_path/Frameworks", 878 | ); 879 | PRODUCT_BUNDLE_IDENTIFIER = com.github.eytyet.TestProgressMaskViewTests; 880 | PRODUCT_NAME = "$(TARGET_NAME)"; 881 | SWIFT_VERSION = 5.0; 882 | TARGETED_DEVICE_FAMILY = "1,2"; 883 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestProgressMaskView.app/TestProgressMaskView"; 884 | }; 885 | name = Release; 886 | }; 887 | B7B1560823F51BA800A84799 /* Debug */ = { 888 | isa = XCBuildConfiguration; 889 | buildSettings = { 890 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 891 | CODE_SIGN_STYLE = Automatic; 892 | DEVELOPMENT_TEAM = R9A97CK9U4; 893 | INFOPLIST_FILE = TestProgressMaskViewAppUITests/Info.plist; 894 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 895 | LD_RUNPATH_SEARCH_PATHS = ( 896 | "$(inherited)", 897 | "@executable_path/Frameworks", 898 | "@loader_path/Frameworks", 899 | ); 900 | PRODUCT_BUNDLE_IDENTIFIER = com.github.eytyet.TestProgressMaskViewUITests; 901 | PRODUCT_NAME = "$(TARGET_NAME)"; 902 | SWIFT_VERSION = 5.0; 903 | TARGETED_DEVICE_FAMILY = "1,2"; 904 | TEST_TARGET_NAME = TestProgressMaskView; 905 | }; 906 | name = Debug; 907 | }; 908 | B7B1560923F51BA800A84799 /* Release */ = { 909 | isa = XCBuildConfiguration; 910 | buildSettings = { 911 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 912 | CODE_SIGN_STYLE = Automatic; 913 | DEVELOPMENT_TEAM = R9A97CK9U4; 914 | INFOPLIST_FILE = TestProgressMaskViewAppUITests/Info.plist; 915 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 916 | LD_RUNPATH_SEARCH_PATHS = ( 917 | "$(inherited)", 918 | "@executable_path/Frameworks", 919 | "@loader_path/Frameworks", 920 | ); 921 | PRODUCT_BUNDLE_IDENTIFIER = com.github.eytyet.TestProgressMaskViewUITests; 922 | PRODUCT_NAME = "$(TARGET_NAME)"; 923 | SWIFT_VERSION = 5.0; 924 | TARGETED_DEVICE_FAMILY = "1,2"; 925 | TEST_TARGET_NAME = TestProgressMaskView; 926 | }; 927 | name = Release; 928 | }; 929 | /* End XCBuildConfiguration section */ 930 | 931 | /* Begin XCConfigurationList section */ 932 | B74B28AC22D201DC00D111F3 /* Build configuration list for PBXProject "ProgressMaskView" */ = { 933 | isa = XCConfigurationList; 934 | buildConfigurations = ( 935 | B74B28C422D201DC00D111F3 /* Debug */, 936 | B74B28C522D201DC00D111F3 /* Release */, 937 | ); 938 | defaultConfigurationIsVisible = 0; 939 | defaultConfigurationName = Release; 940 | }; 941 | B74B28C622D201DC00D111F3 /* Build configuration list for PBXNativeTarget "ProgressMaskView" */ = { 942 | isa = XCConfigurationList; 943 | buildConfigurations = ( 944 | B74B28C722D201DC00D111F3 /* Debug */, 945 | B74B28C822D201DC00D111F3 /* Release */, 946 | ); 947 | defaultConfigurationIsVisible = 0; 948 | defaultConfigurationName = Release; 949 | }; 950 | B74B28C922D201DC00D111F3 /* Build configuration list for PBXNativeTarget "ProgressMaskViewTests" */ = { 951 | isa = XCConfigurationList; 952 | buildConfigurations = ( 953 | B74B28CA22D201DC00D111F3 /* Debug */, 954 | B74B28CB22D201DC00D111F3 /* Release */, 955 | ); 956 | defaultConfigurationIsVisible = 0; 957 | defaultConfigurationName = Release; 958 | }; 959 | B7B1560A23F51BA800A84799 /* Build configuration list for PBXNativeTarget "TestProgressMaskViewApp" */ = { 960 | isa = XCConfigurationList; 961 | buildConfigurations = ( 962 | B7B1560423F51BA800A84799 /* Debug */, 963 | B7B1560523F51BA800A84799 /* Release */, 964 | ); 965 | defaultConfigurationIsVisible = 0; 966 | defaultConfigurationName = Release; 967 | }; 968 | B7B1560B23F51BA800A84799 /* Build configuration list for PBXNativeTarget "TestProgressMaskViewAppTests" */ = { 969 | isa = XCConfigurationList; 970 | buildConfigurations = ( 971 | B7B1560623F51BA800A84799 /* Debug */, 972 | B7B1560723F51BA800A84799 /* Release */, 973 | ); 974 | defaultConfigurationIsVisible = 0; 975 | defaultConfigurationName = Release; 976 | }; 977 | B7B1560C23F51BA800A84799 /* Build configuration list for PBXNativeTarget "TestProgressMaskViewAppUITests" */ = { 978 | isa = XCConfigurationList; 979 | buildConfigurations = ( 980 | B7B1560823F51BA800A84799 /* Debug */, 981 | B7B1560923F51BA800A84799 /* Release */, 982 | ); 983 | defaultConfigurationIsVisible = 0; 984 | defaultConfigurationName = Release; 985 | }; 986 | /* End XCConfigurationList section */ 987 | }; 988 | rootObject = B74B28A922D201DC00D111F3 /* Project object */; 989 | } 990 | -------------------------------------------------------------------------------- /ProgressMaskView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ProgressMaskView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ProgressMaskView.xcodeproj/xcshareddata/xcschemes/ProgressMaskView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /ProgressMaskView.xcodeproj/xcuserdata/yusoftware.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ProgressMaskView.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | TestProgressMaskView.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 1 16 | 17 | TestProgressMaskViewApp.xcscheme_^#shared#^_ 18 | 19 | orderHint 20 | 1 21 | 22 | 23 | SuppressBuildableAutocreation 24 | 25 | B74B28B122D201DC00D111F3 26 | 27 | primary 28 | 29 | 30 | B74B28BA22D201DC00D111F3 31 | 32 | primary 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ProgressMaskView/ArcShape.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ArcShape.swift 3 | // ProgressMaskView 4 | // 5 | // Created by eytyet on 2019/07/17. 6 | // Copyright © 2019 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | /// Protocol for a view of arc shape 12 | /// Width and height is the same. 13 | protocol ArcShape { 14 | 15 | /// Set length of width and height of the view. 16 | var widthAndHeight: CGFloat { get set } 17 | 18 | /// When true, it automatically reduce arc size to fit into the bound size. 19 | var autoFitInside: Bool { get set } 20 | 21 | /// Set radius of the arc as a ratio against widthAndHeight. 0 - 0.5. 0.5 is largest. 22 | var arcRadiusRatio: CGFloat { get set } 23 | 24 | /// Distance between circle center to arc line center. 25 | var arcRadius: CGFloat { get } 26 | 27 | /// Set width of the arc line as a ratio against widthAndHeight. 0 - 1. 28 | var arcLineWidthRatio: CGFloat { get set } 29 | 30 | /// widthAndHeight * arcLineWidthRatio. 31 | var arcLineWidth: CGFloat { get } 32 | 33 | /// Set center point of the arc in the view as a ratio against widthAndHeight. Center is (0.5, 0.5) 34 | var arcCenterRatio: CGPoint { get set } 35 | 36 | /// Center of the arc. 37 | var arcCenter: CGPoint { get } 38 | 39 | /// Gradation to clear of the line color. 0 - 1. 0 is no gradation. 40 | var arcGradation: CGFloat { get set } 41 | 42 | /// Blend ratio at clockwise side of the line. 0 - 1. 43 | var startAngle: CGFloat { get set } 44 | 45 | /// Clockwise side of line. In radian. 46 | var endAngle: CGFloat { get set } 47 | } 48 | 49 | // MARK : - Default implementations 50 | 51 | extension ArcShape { 52 | 53 | /// Radius of arc. Rasius is from the center of circle to the center of line width. 54 | var arcRadius: CGFloat { 55 | return widthAndHeight * (arcRadiusRatio - arcLineWidthRatio / 2) 56 | } 57 | 58 | /// Line width. 59 | var arcLineWidth: CGFloat { 60 | return widthAndHeight * arcLineWidthRatio 61 | } 62 | } 63 | 64 | extension ArcShape where Self: UIView { 65 | 66 | /// Center position. 67 | var arcCenter: CGPoint { 68 | let minLength = min(bounds.width, bounds.height) 69 | return CGPoint(x: minLength * arcCenterRatio.x, y: minLength * arcCenterRatio.y ) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /ProgressMaskView/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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /ProgressMaskView/LineArcRotateView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineArcView.swift 3 | // ProgressMaskView 4 | // 5 | // Created by eytyet on 2019/07/13. 6 | // Copyright © 2019 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | /// UIView of a thick beautiful arc. Rotatable. 13 | @IBDesignable 14 | class LineArcRotateView: UIView, ArcShape { 15 | 16 | /// Arc view on front side. 17 | private let foregroundArcView: LineArcView 18 | 19 | /// Arc view on back side. Two arcs show beautiful colors. 20 | private let backgroundArcView: LineArcView 21 | 22 | /// Flag. 23 | private var isRotating: Bool = false 24 | 25 | /// Layer of foregroundArcView 26 | private var foregroundArcLayer: RotateLayer! 27 | 28 | /// Layer of backgroundArcView 29 | private var backgroundArcLayer: RotateLayer! 30 | 31 | /// Angle difference between front and back. Used to color change. 32 | public var angleDifference = CGFloat.pi / 2 { 33 | didSet { 34 | backgroundArcLayer.offsetAngle = -Float(angleDifference) 35 | } 36 | } 37 | 38 | // MRAK: ArcShape protocol 39 | 40 | /// Size of view. Only one value since it must be square 41 | @IBInspectable public var widthAndHeight: CGFloat { 42 | get { foregroundArcView.widthAndHeight } 43 | set { 44 | foregroundArcView.widthAndHeight = newValue 45 | backgroundArcView.widthAndHeight = newValue 46 | } 47 | } 48 | 49 | /// If true, the diameter is always smaller than widthAndHeight. 50 | @IBInspectable public var autoFitInside: Bool { 51 | get { foregroundArcView.autoFitInside } 52 | set { 53 | foregroundArcView.autoFitInside = newValue 54 | backgroundArcView.autoFitInside = newValue 55 | } 56 | } 57 | 58 | /// Ratio of the arc radius against widthAndHeight. 0.5 is maximum. 59 | @IBInspectable public var arcRadiusRatio: CGFloat { 60 | get { foregroundArcView.arcRadiusRatio } 61 | set { 62 | foregroundArcView.arcRadiusRatio = newValue 63 | backgroundArcView.arcRadiusRatio = newValue 64 | } 65 | } 66 | 67 | /// Ratio of the arc line width against widthAndHeight. 68 | /// If arcRadiusRatio is 0.45 and arcLineWidthRatio is 0.02, line fills 0.43-0.46. 69 | @IBInspectable public var arcLineWidthRatio: CGFloat { 70 | get { foregroundArcView.arcLineWidthRatio } 71 | set { 72 | foregroundArcView.arcLineWidthRatio = newValue 73 | backgroundArcView.arcLineWidthRatio = newValue 74 | } 75 | } 76 | 77 | /// Ratio of the arc center. 78 | @IBInspectable public var arcCenterRatio: CGPoint { 79 | get { foregroundArcView.arcCenterRatio } 80 | set { 81 | foregroundArcView.arcCenterRatio = newValue 82 | backgroundArcView.arcCenterRatio = newValue 83 | } 84 | } 85 | 86 | /// Ratio of the arc line color mix. 87 | @IBInspectable public var arcGradation: CGFloat { 88 | get { foregroundArcView.arcGradation } 89 | set { 90 | foregroundArcView.arcGradation = newValue 91 | backgroundArcView.arcGradation = newValue 92 | } 93 | } 94 | 95 | /// Arc line fill color 1 96 | @IBInspectable public var arcColor1: UIColor { 97 | get { foregroundArcView.lineColor } 98 | set { foregroundArcView.lineColor = newValue } 99 | } 100 | 101 | /// Arc line fill color 2 102 | @IBInspectable public var arcColor2: UIColor { 103 | get { backgroundArcView.lineColor } 104 | set { backgroundArcView.lineColor = newValue } 105 | } 106 | 107 | /// Start angle 108 | @IBInspectable public var startAngle: CGFloat { 109 | get { foregroundArcView.startAngle } 110 | set { 111 | foregroundArcView.startAngle = newValue 112 | backgroundArcView.startAngle = newValue + angleDifference 113 | } 114 | } 115 | 116 | /// End angle. It should be endAngle < startAngle. 117 | @IBInspectable public var endAngle: CGFloat { 118 | get { foregroundArcView.endAngle } 119 | set { 120 | foregroundArcView.endAngle = newValue 121 | backgroundArcView.endAngle = newValue + angleDifference 122 | } 123 | } 124 | 125 | // MARK: - UIView 126 | 127 | override init(frame: CGRect) { 128 | backgroundArcView = LineArcView(frame: frame) 129 | foregroundArcView = LineArcView(frame: frame) 130 | super.init(frame: frame) 131 | setup() 132 | } 133 | 134 | required init?(coder aDecoder: NSCoder) { 135 | let dummy = CGRect(x: 0, y: 0, width: 100, height: 100) 136 | backgroundArcView = LineArcView(frame: dummy) 137 | foregroundArcView = LineArcView(frame: dummy) 138 | super.init(coder: aDecoder) 139 | setup() 140 | } 141 | 142 | override func sizeThatFits(_ size: CGSize) -> CGSize { 143 | return CGSize(width: widthAndHeight, height: widthAndHeight) 144 | } 145 | 146 | override var intrinsicContentSize: CGSize { 147 | return CGSize(width: widthAndHeight, height: widthAndHeight) 148 | } 149 | 150 | // MARK: - Methods 151 | 152 | /// setup views, constraints and default values. 153 | private func setup() { 154 | func addAndSetup(_ view: LineArcView) { 155 | addAndSetConstraint(view) 156 | view.shouldAnimate = true 157 | } 158 | addAndSetup(backgroundArcView) 159 | addAndSetup(foregroundArcView) 160 | let squareConstraint = NSLayoutConstraint(item: self, attribute: .width, relatedBy: .equal, toItem: self, attribute: .height, multiplier: 1, constant: 0) 161 | addConstraint(squareConstraint) 162 | foregroundArcView.shouldAnimate = true 163 | backgroundArcView.shouldAnimate = true 164 | foregroundArcLayer = (foregroundArcView.layer as! RotateLayer) 165 | backgroundArcLayer = (backgroundArcView.layer as! RotateLayer) 166 | backgroundArcLayer.offsetAngle = -Float(angleDifference) 167 | arcRadiusRatio = 0.45 168 | arcLineWidthRatio = 0.05 169 | endAngle = 0 170 | startAngle = 0 171 | } 172 | 173 | /// Start rotate animation 174 | /// - Parameter duration: Time period of one rotation. 175 | func startRotation(duration: TimeInterval) { 176 | guard isRotating == false else { return } 177 | isRotating = true 178 | foregroundArcLayer.rotate(duration: duration) 179 | backgroundArcLayer.rotate(duration: duration) 180 | 181 | } 182 | 183 | /// Stop rotate animation. 184 | func stopRotation() { 185 | isRotating = false 186 | foregroundArcLayer.stopRotation() 187 | backgroundArcLayer.stopRotation() 188 | } 189 | 190 | /// Setup initial angle without animation 191 | /// - Parameters: 192 | /// - start: Start angle of the arc in radian. 193 | /// - end: End angle of the arc in radian. 194 | /// - offset: Offset of angle in radian. If 0, start/end angle begin at 03:00. -pi/2 is 0:00. 195 | func setInitialAngle(start: CGFloat, end: CGFloat, offset: CGFloat? = nil) { 196 | func setup(_ view: LineArcView, diff: CGFloat) { 197 | view.shouldAnimate = false 198 | view.startAngle = start + diff 199 | view.endAngle = end + diff 200 | if let offset = offset { 201 | view.offsetAngle = offset 202 | } 203 | view.shouldAnimate = true 204 | } 205 | setup(foregroundArcView, diff: 0) 206 | setup(backgroundArcView, diff: angleDifference) 207 | } 208 | 209 | } 210 | 211 | 212 | 213 | 214 | 215 | -------------------------------------------------------------------------------- /ProgressMaskView/LineArcView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineArcView.swift 3 | // ProgressMaskView 4 | // 5 | // Created by eytyet on 2019/07/17. 6 | // Copyright © 2019 Yu Software. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Arc with thick line filled with two color gradation. 12 | @IBDesignable 13 | class LineArcView: UIView, ArcShape { 14 | 15 | /// Bounds at current state. 16 | private var currentBounds: CGRect 17 | 18 | /// Start angle of arc at current state. 19 | private var currentStartAngle: CGFloat = 0 20 | 21 | /// End angle of arc at current state. 22 | private var currentEndAngle: CGFloat = 0 23 | 24 | /// Threshold to determine whether the same angle or not. 25 | private let angleMinStep = CGFloat.pi / 18000 26 | 27 | /// Step of path animation. 28 | private let angleStep = CGFloat.pi / 90 29 | 30 | /// Timer which is syncronized to the device refresh ratio. 31 | private var angleAnimationLink: CADisplayLink? 32 | 33 | /// If this flag is on, angle change is animaed automatically. Default is false. 34 | public var shouldAnimate = false 35 | 36 | /// Offset against startAngle and endAngle 37 | @IBInspectable var offsetAngle: CGFloat = 0 { 38 | didSet { 39 | (layer as! RotateLayer).offsetAngle = Float(offsetAngle) 40 | } 41 | } 42 | 43 | // MARK: ArcShape protocol 44 | 45 | @IBInspectable var widthAndHeight: CGFloat = 100 { 46 | didSet { requestUpdate() } 47 | } 48 | 49 | @IBInspectable var autoFitInside: Bool = true { 50 | didSet { requestUpdate() } 51 | } 52 | 53 | @IBInspectable var arcRadiusRatio: CGFloat = 0.45 { 54 | didSet { requestUpdate() } 55 | } 56 | 57 | @IBInspectable var arcLineWidthRatio: CGFloat = 0.05 { 58 | didSet { requestUpdate() } 59 | } 60 | 61 | @IBInspectable var arcCenterRatio: CGPoint = CGPoint(x: 0.5, y: 0.5) { 62 | didSet { requestUpdate() } 63 | } 64 | 65 | @IBInspectable var arcGradation: CGFloat = 0.5 { 66 | didSet { requestUpdate() } 67 | } 68 | 69 | @IBInspectable var startAngle: CGFloat = 0 { 70 | didSet { 71 | if shouldAnimate { 72 | currentStartAngle = oldValue 73 | guard angleAnimationLink == nil else { return } 74 | angleAnimationLink = CADisplayLink(target: self, selector: #selector(animateAngles)) 75 | angleAnimationLink?.add(to: .main, forMode: .default) 76 | if #available(iOS 10.0, *) { 77 | angleAnimationLink?.preferredFramesPerSecond = 30 78 | } 79 | } else { 80 | currentStartAngle = startAngle 81 | setNeedsDisplay() 82 | } 83 | } 84 | } 85 | 86 | @IBInspectable var endAngle: CGFloat = 0 { 87 | didSet { 88 | if shouldAnimate { 89 | currentEndAngle = oldValue 90 | guard angleAnimationLink == nil else { return } 91 | angleAnimationLink = CADisplayLink(target: self, selector: #selector(animateAngles)) 92 | angleAnimationLink?.add(to: .main, forMode: .default) 93 | if #available(iOS 10.0, *) { 94 | angleAnimationLink?.preferredFramesPerSecond = 30 95 | } 96 | } else { 97 | currentEndAngle = endAngle 98 | setNeedsDisplay() 99 | } 100 | } 101 | } 102 | 103 | @IBInspectable var lineColor: UIColor = UIColor.white { 104 | didSet { 105 | requestUpdate() 106 | } 107 | } 108 | 109 | /// Remember size of cached information. 110 | private var sizeOfCachedImages: CGSize? 111 | 112 | /// Content of gradientMaskCache 113 | private var _gradientMaskCache: CGImage? 114 | 115 | /// Cache for gradient image mask. 116 | private var gradientMaskCache: CGImage? { 117 | if let size = sizeOfCachedImages, 118 | size.width == bounds.width || size.height == bounds.height { return _gradientMaskCache } 119 | sizeOfCachedImages = bounds.size 120 | let width = Int(bounds.size.width) 121 | let height = Int(bounds.size.height) 122 | let colorSpace = CGColorSpaceCreateDeviceGray() 123 | guard let cg = CGContext(data: nil, width: width, height: height, bitsPerComponent: 8, bytesPerRow: width, space: colorSpace, bitmapInfo: 0) else { 124 | print("ProgressMaskView: Failed to create a CGContext for a gradation mask.") 125 | return _gradientMaskCache 126 | } 127 | let color1 = UIColor.white 128 | let color2 = UIColor.white.withAlphaComponent(1 - arcGradation) 129 | let colors = [color1.cgColor, color2.cgColor] 130 | let points: [CGFloat] = [0, 1] 131 | guard let gradient = CGGradient(colorsSpace: CGColorSpaceCreateDeviceGray(), colors: colors as CFArray, locations: points) else { return _gradientMaskCache } 132 | cg.drawLinearGradient(gradient, start: CGPoint(x: 0, y: 0), end: CGPoint(x: bounds.width, y: 0), options: [.drawsAfterEndLocation, .drawsAfterEndLocation]) // radian 0 is backgroundColor. 133 | guard let maskImage = cg.makeImage() else { return _gradientMaskCache } 134 | let imageMask = CGImage(maskWidth: width, height: height, bitsPerComponent: 8, bitsPerPixel: 8, bytesPerRow: width, provider: maskImage.dataProvider!, decode: nil, shouldInterpolate: false) 135 | _gradientMaskCache = imageMask 136 | return _gradientMaskCache 137 | } 138 | 139 | /// Remember size of cached image. 140 | private var sizeOfFillImage: CGSize? 141 | 142 | /// Content of fillImageCache 143 | private var _fillImageCache: CGImage? 144 | 145 | /// A lineColor filled image. Cached 146 | private var fillImageCache: CGImage? { 147 | if let size = sizeOfCachedImages, 148 | size.width == bounds.width || size.height == bounds.height { return _fillImageCache } 149 | sizeOfFillImage = bounds.size 150 | let width = Int(bounds.size.width) 151 | let height = Int(bounds.size.height) 152 | guard let cg = CGContext(data: nil, width: width, height: height, bitsPerComponent: 8, bytesPerRow: width * 4, space: CGColorSpace(name: CGColorSpace.sRGB)!, bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue) else { 153 | print("ProgressMaskView: Cannot create CGContext for fillImage.") 154 | return _fillImageCache 155 | } 156 | cg.setFillColor(lineColor.cgColor) 157 | cg.fill(bounds) 158 | _fillImageCache = cg.makeImage() 159 | return _fillImageCache 160 | } 161 | 162 | // MARK: - UIView 163 | 164 | override init(frame: CGRect) { 165 | currentBounds = frame 166 | super.init(frame: frame) 167 | setup() 168 | } 169 | 170 | required init?(coder aDecoder: NSCoder) { 171 | fatalError("Not implemented.") 172 | } 173 | 174 | /// Use RotateLayer 175 | override class var layerClass : AnyClass { 176 | return RotateLayer.self 177 | } 178 | 179 | /// This view wants to be widthAndHeight x widthAndHeight in size. 180 | override var intrinsicContentSize: CGSize { 181 | return CGSize(width: widthAndHeight, height: widthAndHeight) 182 | } 183 | 184 | /// Fit inside if required. 185 | override func layoutSubviews() { 186 | guard autoFitInside else { return } 187 | guard currentBounds.size != bounds.size else { return } 188 | currentBounds = frame 189 | let minLength = min(frame.width, frame.height) 190 | widthAndHeight = minLength 191 | } 192 | 193 | /// Draw a thick arc. 194 | override func draw(_ rect: CGRect) { 195 | super.draw(rect) 196 | guard let cg = UIGraphicsGetCurrentContext() else { return } 197 | 198 | let mask = CAShapeLayer() 199 | mask.path = makeArcPath(startAngle: startAngle, endAngle: endAngle) 200 | layer.mask = mask 201 | guard let fillImage = fillImageCache?.copy() else { return } 202 | guard let maskImage = gradientMaskCache else { return } 203 | guard let img = fillImage.masking(maskImage) else { return } 204 | 205 | cg.saveGState() 206 | cg.beginTransparencyLayer(auxiliaryInfo: nil) 207 | cg.setBlendMode(CGBlendMode.normal) 208 | cg.draw(img, in: rect) 209 | cg.clip(to: rect, mask: gradientMaskCache!) 210 | cg.endTransparencyLayer() 211 | cg.restoreGState() 212 | } 213 | 214 | // MARK: - Methods 215 | 216 | /// Initialize UI 217 | private func setup() { 218 | backgroundColor = nil 219 | isOpaque = false 220 | } 221 | 222 | /// Set force redraw 223 | private func requestUpdate() { 224 | sizeOfCachedImages = nil 225 | setNeedsDisplay() 226 | } 227 | 228 | /// Return a closed path of a thick arc 229 | /// - Parameter startAngle: Radian (edge with largear number) 230 | /// - Parameter endAngle: Radian (edge with smaller number) 231 | /// - Returns: CGPath of a closed thick arc shape. 232 | private func makeArcPath(startAngle: CGFloat, endAngle: CGFloat) -> CGPath { 233 | let shape = UIBezierPath(arcCenter: arcCenter, radius: arcRadius + arcLineWidth / 2, startAngle: startAngle, endAngle: endAngle, clockwise: false) 234 | shape.addArc(withCenter: arcCenter, radius: arcRadius - arcLineWidth / 2, startAngle: endAngle, endAngle: startAngle, clockwise: true) 235 | shape.close() 236 | return shape.cgPath 237 | } 238 | 239 | /// Calculate the next angle for animation 240 | /// - Parameter current: Current angle in radian 241 | /// - Parameter final: Target angle in radian 242 | /// - Returns: Next angle in radian. 243 | private func nextTickAngle(current: CGFloat, final: CGFloat) -> CGFloat { 244 | var next:CGFloat = (current + final) / 2 245 | if abs(next - final) > angleStep { 246 | if current < final { 247 | next = current + angleStep 248 | } else { 249 | next = current - angleStep 250 | } 251 | } 252 | return next 253 | } 254 | 255 | /// Set path animation. 256 | /// - Parameter from : Start point of the animation. (Start Angle, End Angle) 257 | /// - Parameter to : End point of the animation. (Start Angle, End Angle) 258 | private func executePathAnimation(from: (CGFloat, CGFloat), to: (CGFloat, CGFloat)) { 259 | let newPath = makeArcPath(startAngle: to.0, endAngle: to.1) 260 | if let mask = layer.mask as? CAShapeLayer { 261 | mask.path = newPath 262 | } 263 | } 264 | 265 | /// Move arc length step by step 266 | /// Automatic layer animation is not suitable for the arc length change because it affects its thickness. Set small amount of change to minimize this side effect. 267 | @objc func animateAngles() { 268 | if abs(currentEndAngle - endAngle) < angleMinStep && abs(currentStartAngle - startAngle) < angleMinStep { 269 | angleAnimationLink?.invalidate() 270 | angleAnimationLink = nil 271 | return 272 | } 273 | let nextStartAngle = nextTickAngle(current: currentStartAngle, final: startAngle) 274 | let nextEndAngle = nextTickAngle(current: currentEndAngle, final: endAngle) 275 | currentStartAngle = nextStartAngle 276 | currentEndAngle = nextEndAngle 277 | executePathAnimation(from: (currentStartAngle, currentEndAngle), to: (nextStartAngle, nextEndAngle)) 278 | } 279 | } 280 | 281 | 282 | 283 | -------------------------------------------------------------------------------- /ProgressMaskView/ProgressMaskBarParameter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressMaskBarParameter.swift 3 | // ProgressMaskView 4 | // 5 | // Created by eytyet on 2020/02/13. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public struct ProgressMaskBarParameter { 12 | var color1: UIColor 13 | var color2: UIColor 14 | var blend: CGFloat 15 | var widthRatio: CGFloat { 16 | didSet { widthRatio = min(max(widthRatio, 0), 0.5) } 17 | } 18 | var radiusRatio: CGFloat { 19 | didSet { radiusRatio = min(max(radiusRatio, 0), 0.5) } 20 | } 21 | 22 | public init(color1: UIColor, color2: UIColor, blend: CGFloat, widthRatio: CGFloat, radiusRatio: CGFloat) { 23 | self.color1 = color1 24 | self.color2 = color2 25 | self.blend = blend 26 | self.widthRatio = widthRatio 27 | self.radiusRatio = radiusRatio 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /ProgressMaskView/ProgressMaskView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressMaskView.h 3 | // ProgressMaskView 4 | // 5 | // Created by eytyet on 2019/07/07. 6 | // Copyright © 2019 Yu Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for ProgressMaskView. 12 | FOUNDATION_EXPORT double ProgressMaskViewVersionNumber; 13 | 14 | //! Project version string for ProgressMaskView. 15 | FOUNDATION_EXPORT const unsigned char ProgressMaskViewVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /ProgressMaskView/ProgressMaskView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressMaskView.swift 3 | // ProgressMaskView 4 | // 5 | // Created by eytyet on 2019/07/07. 6 | // Copyright © 2019 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | private let pi = CGFloat.pi 12 | private let defaultProgressColor1 = UIColor.white 13 | private let defaultProgressColor2 = UIColor.lightGray 14 | private let defaultProgressBlendLevel: CGFloat = 0.9 15 | private let defaultProgressRadius: CGFloat = 0.45 16 | private let defaultProgressWidth: CGFloat = 0.05 17 | private let defaultActivityColor1 = UIColor.white 18 | private let defaultActivityColor2 = UIColor.gray 19 | private let defaultActivityBlendLevel: CGFloat = 0.4 20 | private let defaultActivityRadius: CGFloat = 0.40 21 | private let defaultActivityWidth: CGFloat = 0.05 22 | private let defaultMinCircleSize: CGFloat = 200 23 | private let titleWidthInset: CGFloat = 32 24 | private let titleHeightInset: CGFloat = 16 25 | 26 | 27 | /// Show activity and progress bar in circle shape. 28 | /// Easy to append to existing view controll to let user wait tentatively. 29 | @IBDesignable 30 | public class ProgressMaskView: UIView { 31 | 32 | public enum BarType { 33 | case activity 34 | case progress 35 | } 36 | 37 | /// Text of the title label. 38 | @IBInspectable public var title: String { 39 | set { titleLabel.text = newValue } 40 | get { return titleLabel.text ?? "" } 41 | } 42 | 43 | /// Font of title label. 44 | @IBInspectable public var titleFont: UIFont { 45 | set { titleLabel.font = newValue } 46 | get { return titleLabel.font } 47 | } 48 | 49 | /// Color of title label. 50 | @IBInspectable public var titleColor: UIColor { 51 | set { titleLabel.textColor = newValue } 52 | get { return titleLabel.textColor } 53 | } 54 | 55 | /// First color of the progress circle. Default is white. 56 | @IBInspectable public var progressColor1: UIColor = defaultProgressColor1 { 57 | didSet { circleProgressView.arcColor1 = progressColor1 } 58 | } 59 | 60 | /// Second color of the progress circile. Default is lightGray. 61 | @IBInspectable public var progressColor2: UIColor = defaultProgressColor2 { 62 | didSet { circleProgressView.arcColor2 = progressColor2 } 63 | } 64 | 65 | /// Progress bar color blend ratio. 0 - 1. Default is 0.7 66 | @IBInspectable public var progressBlendLevel: CGFloat = defaultProgressBlendLevel { 67 | didSet { circleProgressView.arcGradation = progressBlendLevel } 68 | } 69 | 70 | /// Progress bar radius ratio. 0 - 0.5. Default is 0.45 71 | @IBInspectable public var progressRadiusRatio: CGFloat = defaultProgressRadius { 72 | didSet { circleProgressView.arcRadiusRatio = progressRadiusRatio } 73 | } 74 | 75 | /// Progress bar width ratio. 0 - 0.5. Default is 0.05 76 | @IBInspectable public var progressWidthRatio: CGFloat = defaultProgressWidth { 77 | didSet { circleProgressView.arcLineWidthRatio = progressWidthRatio } 78 | } 79 | /// Progress bar start degrerr. 0 - 360. 0 is 12:00. 80 | @IBInspectable public var progressZeroDegree: Float = 0 { 81 | didSet { 82 | let radian = CGFloat(progressZeroDegree - 90) * pi / 180 83 | circleProgressView.setInitialAngle(start: radian, end: radian) 84 | } 85 | } 86 | 87 | /// First color of activity circle. Default is white. 88 | @IBInspectable public var activityColor1: UIColor = defaultActivityColor1 { 89 | didSet { circleActivityView.arcColor1 = activityColor1 } 90 | } 91 | 92 | /// Second color of activity circle. Default is gray. 93 | @IBInspectable public var activityColor2: UIColor = defaultActivityColor2 { 94 | didSet { circleActivityView.arcColor2 = activityColor2 } 95 | } 96 | 97 | /// Activity color blend ratio. 0 - 1. Default is 0.4 98 | @IBInspectable public var activityBlendLevel: CGFloat = defaultActivityBlendLevel { 99 | didSet { circleActivityView.arcGradation = defaultActivityBlendLevel } 100 | } 101 | 102 | /// Activity radius ratio. 0 - 0.5. Default is 0.4 103 | @IBInspectable public var activityRadiusRatio: CGFloat = defaultActivityRadius { 104 | didSet { circleActivityView.arcRadiusRatio = activityRadiusRatio } 105 | } 106 | 107 | /// Activity width ratio. 0 - 0.5. Default is 0.05 108 | @IBInspectable public var activityWidthRatio: CGFloat = defaultActivityWidth { 109 | didSet { circleActivityView.arcLineWidthRatio = activityWidthRatio } 110 | } 111 | 112 | /// Content of progress property. 113 | private var _progress: CGFloat = 0 114 | 115 | /// Progress of the progress bar. 0 - 1.0. Default is 0. 116 | public var progress: Float { 117 | get { Float(_progress) } 118 | set { 119 | _progress = CGFloat(newValue) 120 | DispatchQueue.main.syncInMainButAsyncIfNot { 121 | self.circleProgressView.startAngle = pi * 2 * self._progress + self.circleProgressView.endAngle 122 | } 123 | } 124 | } 125 | 126 | /// Color of the base corner round view 127 | public var backgroundPlateColor: UIColor = UIColor(white: 0.6, alpha: 0.9) { 128 | didSet { backgroundRoundView.backgroundColor = backgroundPlateColor } 129 | } 130 | 131 | /// Corner round view which ha all UI parts. 132 | private var backgroundRoundView: SimpleRView! 133 | 134 | /// Title label shown in center of the circles. 135 | private var titleLabel: UILabel! 136 | 137 | /// Activity view. 138 | private var circleActivityView: LineArcRotateView! 139 | 140 | /// Progress view. 141 | private var circleProgressView: LineArcRotateView! 142 | 143 | /// Time for color animation of activity view.. 144 | private var timer: Timer? 145 | 146 | /// Parameter to control length of activity view. 147 | private var animationDirection: Int = -8 148 | 149 | /// Cache of an angle unit value. 150 | private let angleStep = CGFloat.pi / 90 151 | 152 | // MARK: - UIView 153 | 154 | public override init(frame: CGRect) { 155 | super.init(frame: frame) 156 | setup() 157 | } 158 | 159 | public required init?(coder aDecoder: NSCoder) { 160 | super.init(coder: aDecoder) 161 | setup() 162 | } 163 | 164 | public override func prepareForInterfaceBuilder() { 165 | circleProgressView.setInitialAngle(start: .pi * 1.3, end: .pi * -0.5) 166 | circleActivityView.setInitialAngle(start: .pi, end: .pi * 0.3) 167 | } 168 | 169 | // MARK: - Methods 170 | 171 | /// Create all views and set up all constraints. 172 | /// default value of each property did not passed to its didSet block. So call it again at here. 173 | private func setup() { 174 | 175 | alpha = 0 176 | isUserInteractionEnabled = true // Disable user input. 177 | 178 | // Darken all area. 179 | backgroundColor = UIColor(white: 0, alpha: 0.7) 180 | 181 | // Base round view 182 | backgroundRoundView = SimpleRView(frame: frame) 183 | backgroundRoundView.cornerRadius = 32 184 | backgroundPlateColor = UIColor(white: 0.6, alpha: 0.9) 185 | addSubview(backgroundRoundView) 186 | backgroundRoundView.translatesAutoresizingMaskIntoConstraints = false 187 | NSLayoutConstraint.activate([ 188 | backgroundRoundView.topAnchor.constraint(greaterThanOrEqualTo: topAnchor, constant: 8), 189 | backgroundRoundView.bottomAnchor.constraint(lessThanOrEqualTo: bottomAnchor, constant: -8), 190 | backgroundRoundView.leftAnchor.constraint(greaterThanOrEqualTo: leftAnchor, constant: 8), 191 | backgroundRoundView.rightAnchor.constraint(lessThanOrEqualTo: rightAnchor, constant: -8), 192 | backgroundRoundView.centerXAnchor.constraint(equalTo: centerXAnchor), 193 | backgroundRoundView.centerYAnchor.constraint(equalTo: centerYAnchor) 194 | ]) 195 | // Progress View 196 | circleProgressView = LineArcRotateView(frame: frame) 197 | circleProgressView.setInitialAngle(start: 0, end: 0) 198 | circleProgressView.widthAndHeight = defaultMinCircleSize 199 | progressColor1 = defaultProgressColor1 200 | progressColor2 = defaultProgressColor2 201 | progressBlendLevel = defaultProgressBlendLevel 202 | progressRadiusRatio = defaultProgressRadius 203 | progressWidthRatio = defaultProgressWidth 204 | progressZeroDegree = 0 205 | backgroundRoundView.addSubview(circleProgressView) 206 | backgroundRoundView.addAndSetConstraint(circleProgressView, margin: 16) 207 | 208 | // Activity View 209 | circleActivityView = LineArcRotateView(frame: frame) 210 | circleActivityView.setInitialAngle(start: 0, end: 0) 211 | circleActivityView.widthAndHeight = defaultMinCircleSize 212 | activityColor1 = defaultActivityColor1 213 | activityColor2 = defaultActivityColor2 214 | activityBlendLevel = defaultActivityBlendLevel 215 | activityRadiusRatio = defaultActivityRadius 216 | activityWidthRatio = defaultActivityWidth 217 | backgroundRoundView.addSubview(circleActivityView) 218 | backgroundRoundView.addAndSetConstraint(circleActivityView, margin: 16) 219 | 220 | // Label at center. 221 | titleLabel = UILabel(frame: frame) 222 | titleLabel.font = UIFont.preferredFont(forTextStyle: .headline) 223 | titleLabel.textAlignment = .center 224 | backgroundRoundView.addSubview(titleLabel) 225 | titleLabel.translatesAutoresizingMaskIntoConstraints = false 226 | NSLayoutConstraint.activate([ 227 | titleLabel.topAnchor.constraint(greaterThanOrEqualTo: backgroundRoundView.topAnchor, constant: titleWidthInset), 228 | titleLabel.bottomAnchor.constraint(greaterThanOrEqualTo: backgroundRoundView.bottomAnchor, constant: -titleWidthInset), 229 | titleLabel.leftAnchor.constraint(greaterThanOrEqualTo: backgroundRoundView.leftAnchor, constant: titleHeightInset), 230 | titleLabel.rightAnchor.constraint(lessThanOrEqualTo: backgroundRoundView.rightAnchor, constant: -titleHeightInset), 231 | titleLabel.centerYAnchor.constraint(equalTo: backgroundRoundView.centerYAnchor), 232 | titleLabel.centerXAnchor.constraint(equalTo: backgroundRoundView.centerXAnchor) 233 | ]) 234 | } 235 | 236 | /// Setup all parameters of activity or progress bar. 237 | /// - Parameters: 238 | /// - bar: which bar to be set. 239 | /// - parameter: parameters of the bar 240 | public func setParameters(bar: BarType, parameter: ProgressMaskBarParameter) { 241 | switch bar { 242 | case .activity: 243 | activityColor1 = parameter.color1 244 | activityColor2 = parameter.color2 245 | activityBlendLevel = parameter.blend 246 | activityRadiusRatio = parameter.radiusRatio 247 | activityWidthRatio = parameter.widthRatio 248 | case .progress: 249 | progressColor1 = parameter.color1 250 | progressColor2 = parameter.color2 251 | progressBlendLevel = parameter.blend 252 | progressRadiusRatio = parameter.radiusRatio 253 | progressWidthRatio = parameter.widthRatio 254 | } 255 | } 256 | 257 | /// Add this view onto the given view and set constraint for 4 sides. 258 | /// - Parameter view: Specify a parent view. 259 | public func install(to view: UIView) { 260 | DispatchQueue.main.syncInMainButAsyncIfNot { 261 | view.addAndSetConstraint(self) 262 | } 263 | } 264 | 265 | /// Add this view onto the given view controller and set constraint for 4 sides. 266 | /// This function will install this view to the UITabBarController if exist. If not, to UINavigationController. If not, to the passed controller. 267 | /// - Parameter controller: Specify current UIViewController. (e.g. "self") 268 | public func install(to controller: UIViewController) { 269 | DispatchQueue.main.syncInMainButAsyncIfNot { 270 | if let tab = controller.tabBarController { 271 | tab.view.addAndSetConstraint(self) 272 | } else if let navi = controller.navigationController { 273 | navi.view.addAndSetConstraint(self) 274 | } else { 275 | controller.view.addAndSetConstraint(self) 276 | } 277 | } 278 | } 279 | 280 | /// Appear. 281 | /// - Parameter duration: Optional. Fade in animation duration in second. Default is 0.3. 282 | public func show(in duration: TimeInterval = 0.3) { 283 | DispatchQueue.main.syncInMainButAsyncIfNot { 284 | self.startActivityAnimation() 285 | UIView.animate(withDuration: duration) { 286 | self.alpha = 1 287 | } 288 | } 289 | } 290 | 291 | /// Disappear. 292 | /// - Parameters: 293 | /// - duration: Optional. Default is 0.3. Fade out animation duration in second. 294 | /// - uninstall: Optional. Set true (default) to remove this view from the view hierarchly. If false, it is disappeared since alpha is 0 but remains in the view hierarchly. 295 | /// - completion: Optional. completion handler. 296 | public func hide(in duration: TimeInterval = 0.3, uninstall: Bool = true, completion: (()->())? = nil) { 297 | DispatchQueue.main.syncInMainButAsyncIfNot { 298 | UIView.animate(withDuration: duration, animations: { 299 | self.alpha = 0 300 | }, completion: { _ in 301 | self.stopActivityAnimation() 302 | if uninstall { 303 | self.removeFromSuperview() 304 | } else { 305 | self.progress = 0 // Prepare for next execution. 306 | } 307 | completion?() 308 | }) 309 | } 310 | } 311 | 312 | /// Start animation 313 | private func startActivityAnimation() { 314 | circleActivityView.endAngle = circleActivityView.startAngle - pi / 2 315 | circleActivityView.startRotation(duration: 2.0) 316 | startTimer() 317 | } 318 | 319 | /// Stop animation 320 | private func stopActivityAnimation() { 321 | stopTimer() 322 | circleActivityView.stopRotation() 323 | } 324 | 325 | /// Start animation timer 326 | private func startTimer() { 327 | guard timer == nil else { return } 328 | timer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(timerCallback), userInfo: nil, repeats: true) 329 | } 330 | 331 | /// Stop animation timer 332 | private func stopTimer() { 333 | timer?.invalidate() 334 | timer = nil 335 | } 336 | 337 | /// Timer callback to control activity bar length and color. 338 | @objc func timerCallback() { 339 | let center = animationDirection > 0 ? 4 : -4 340 | let d = angleStep * CGFloat(center - animationDirection) 341 | let d2 = angleStep * 4 342 | circleActivityView.endAngle += d + d2 343 | circleActivityView.startAngle += d2 344 | if animationDirection > 0 { 345 | animationDirection = animationDirection == 1 ? -8 : animationDirection - 1 346 | } else { 347 | animationDirection = animationDirection == -1 ? 8 : animationDirection + 1 348 | } 349 | } 350 | } 351 | 352 | 353 | -------------------------------------------------------------------------------- /ProgressMaskView/RotateLayer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RotateLayer.swift 3 | // ProgressMaskView 4 | // 5 | // Created by eytyet on 2019/07/19. 6 | // Copyright © 2019 Yu Software. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | fileprivate let keyRotationZ = "transform.rotation.z" 12 | 13 | /// Layer with automatic rotation feature. 14 | class RotateLayer: CALayer { 15 | /// Rotation degree offset 16 | dynamic var offsetAngle: Float = 0 { 17 | didSet { 18 | transform = Tool.matrixRotateZ(offsetAngle) 19 | } 20 | } 21 | 22 | // MARK: - CALayer 23 | 24 | override init() { 25 | super.init() 26 | transform = Tool.matrixRotateZ(0.0) 27 | } 28 | 29 | required init?(coder aDecoder: NSCoder) { 30 | fatalError("init(coder:) has not been implemented") 31 | } 32 | 33 | /// This is used to duplicate layers to presentation layers. 34 | override init(layer: Any) { 35 | super.init(layer: layer) 36 | let original = layer as! RotateLayer 37 | offsetAngle = original.offsetAngle 38 | transform = original.transform 39 | } 40 | 41 | /// Notify needs of redraw. 42 | override class func needsDisplay(forKey key: String) -> Bool { 43 | if key == "offsetAngle" { 44 | return false 45 | } 46 | return super.needsDisplay(forKey: key) 47 | } 48 | 49 | // MARK: - Methods 50 | 51 | /// Start rotation. 52 | /// - Parameters: 53 | /// - duration: Time of one round. 54 | /// - startAngle: Start angle. omit it to start current location. 55 | func rotate(duration: TimeInterval, from startAngle: Float? = nil) { 56 | guard animation(forKey: keyRotationZ) == nil else { return } 57 | var start: Float 58 | if let angle = startAngle { 59 | start = angle 60 | } else { 61 | start = Tool.convertRotationZToRadian(from: transform) + offsetAngle 62 | } 63 | let anime = CABasicAnimation(keyPath: keyRotationZ) 64 | anime.duration = duration 65 | anime.fromValue = NSNumber(value: start - offsetAngle) 66 | anime.toValue = NSNumber(value: start - offsetAngle + .pi * 2) 67 | anime.repeatCount = .infinity 68 | add(anime, forKey: keyRotationZ) 69 | } 70 | 71 | /// Stop rotation. 72 | func stopRotation() { 73 | if let current = presentation() { 74 | transform = current.transform 75 | } 76 | removeAnimation(forKey: keyRotationZ) 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ProgressMaskView/SimpleRView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleRView.swift 3 | // ProgressMaskView 4 | // 5 | // Created by eytyet on 2019/07/07. 6 | // Copyright © 2019 Yu Software. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | @IBDesignable 13 | class SimpleRView: UIView { 14 | @IBInspectable var cornerRadius : CGFloat { 15 | get { layer.cornerRadius } 16 | set { layer.cornerRadius = newValue } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ProgressMaskView/Tools.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Tools.swift 3 | // ProgressMaskView 4 | // 5 | // Created by eytyet on 2019/07/17. 6 | // Copyright © 2019 Yu Software. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Keep common functions into Tool namespace 12 | struct Tool { 13 | /// Create rotation matrix for Z rotation. 14 | /// - Parameter radian: Rotation angle in radian. 15 | /// - Returns: A rotation matrix. 16 | static func matrixRotateZ(_ radian:Float) -> CATransform3D { 17 | return CATransform3DMakeRotation(CGFloat(radian), 0, 0, 1) 18 | } 19 | 20 | /// Return rotation angle in radian for matrixRotateZ. 21 | /// Note that the value may be 0 or 3.14... or 6.28... for 0 degree. 22 | /// - Parameter transform: Z rotation matrix 23 | /// - Returns: Rotation angle in radian 24 | static func convertRotationZToRadian(from transform:CATransform3D) -> Float { 25 | let cos = transform.m11 26 | let sin = transform.m12 27 | let radian = atan(sin/cos) 28 | if cos < 0 { 29 | return Float(radian) + Float.pi 30 | } 31 | return Float(radian) 32 | } 33 | } 34 | 35 | // MARK: - UIView Extension 36 | 37 | extension UIView { 38 | /// Add sub view and set the same constraints for 4 edges 39 | /// - Parameters: 40 | /// - childView: UIView to be added as subview to this view. 41 | /// - margin: Optional space between this view and subview for 4 edges. Default is 0. 42 | func addAndSetConstraint(_ childView: UIView, margin:CGFloat = 0) { 43 | addSubview(childView) 44 | childView.translatesAutoresizingMaskIntoConstraints = false 45 | addConstraints([ 46 | childView.topAnchor.constraint(equalTo: topAnchor, constant: margin), 47 | bottomAnchor.constraint(equalTo: childView.bottomAnchor, constant: margin), 48 | childView.leftAnchor.constraint(equalTo: leftAnchor, constant: margin), 49 | rightAnchor.constraint(equalTo: childView.rightAnchor, constant: margin) 50 | ]) 51 | } 52 | } 53 | 54 | // MARK: - DispatchQueue Extension 55 | 56 | extension DispatchQueue { 57 | public func syncInMainButAsyncIfNot(_ block: @escaping () -> ()) { 58 | if Thread.isMainThread { 59 | block() // Execute immediately if in the main thread. 60 | } else { 61 | DispatchQueue.main.async { 62 | block() // Execute in Main thread asyncronously. 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /ProgressMaskViewTests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ProgressMaskViewTests/ProgressMaskViewTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressMaskViewTests.swift 3 | // ProgressMaskViewTests 4 | // 5 | // Created by eytyet on 2019/07/07. 6 | // Copyright © 2019 Yu Software. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import ProgressMaskView 11 | 12 | class ProgressMaskViewTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testTools() { 23 | 24 | // Check matrixRotateZ and convertRotationZToRadian function 25 | func check(_ radian: CGFloat) { 26 | let a = Tool.matrixRotateZ(Float(radian)) 27 | let b = Tool.convertRotationZToRadian(from: a) 28 | let diff = abs(radian - CGFloat(b)) 29 | let remainder = diff.remainder(dividingBy: CGFloat.pi) 30 | XCTAssertTrue(remainder < 0.000001, "Failed. Original radian is '\(radian)'. reverted radian is '\(b)'. diff=\(diff), remainder=\(remainder)" ) 31 | print("diff = \(remainder)") 32 | } 33 | let dig90 = CGFloat.pi / 2 34 | let dig30 = CGFloat.pi / 6 35 | for i in -2 ... 2 { 36 | for j in 0 ..< 3 { 37 | print("Test \(90 * i + 30 * j) degree.") 38 | check(dig90 * CGFloat(i) + dig30 * CGFloat(j)) 39 | } 40 | } 41 | } 42 | 43 | func testArcShape() { 44 | struct Test: ArcShape { 45 | var widthAndHeight: CGFloat 46 | var autoFitInside: Bool 47 | var arcRadiusRatio: CGFloat 48 | var arcLineWidthRatio: CGFloat 49 | var arcCenterRatio: CGPoint 50 | var arcCenter: CGPoint 51 | var arcGradation: CGFloat 52 | var startAngle: CGFloat 53 | var endAngle: CGFloat 54 | } 55 | 56 | var a = Test(widthAndHeight: 100, autoFitInside: false, arcRadiusRatio: 0.5, arcLineWidthRatio: 0.1, arcCenterRatio: CGPoint(x: 0.5, y: 0.5), arcCenter: CGPoint(x: 50, y: 50), arcGradation: 1, startAngle: 0, endAngle: .pi) 57 | XCTAssert(a.arcRadius == 45) 58 | XCTAssert(a.arcLineWidth == 10) 59 | 60 | a.arcRadiusRatio = 0.4 61 | XCTAssert(a.arcRadius == 35) 62 | XCTAssert(a.arcLineWidth == 10) 63 | 64 | a.arcLineWidthRatio = 0.4 65 | XCTAssert(a.arcRadius == 20) 66 | XCTAssert(a.arcLineWidth == 40) 67 | } 68 | 69 | func testScopes() { 70 | // Check these functions are accessible or not. 71 | var progressMaskView = ProgressMaskView() 72 | progressMaskView = ProgressMaskView(frame:CGRect.zero) 73 | let _ = ProgressMaskView.init(coder:) 74 | let _ = ProgressMaskView.BarType.self 75 | let _ = ProgressMaskView.show 76 | let _ = ProgressMaskView.hide 77 | let _ = progressMaskView.setParameters(bar:parameter:) 78 | // Check properties 79 | let _ = progressMaskView.progress 80 | let _ = progressMaskView.backgroundPlateColor 81 | } 82 | 83 | func testPerformanceExample() { 84 | // This is an example of a performance test case. 85 | self.measure { 86 | // Put the code you want to measure the time of here. 87 | } 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProgressMaskView for iOS 2 | 3 | **Progress Mask View** is a view which covers the entire screen to disable any user interaction including Tab bar items and navigation bar buttons. It shows an activity indicator and a progress bar. User can aware that any interaction is disabled and he/she has to wait. Activity movement and color change are beautiful. 4 | 5 | Basically, you should not use this. Disabling user interaction is not a good idea as a recent modern app. 6 | However, in some case, it is necessary. I created this view to use on a backup function and a restore function since it is not possible to change any data while it is backing up or restoring from the backup data. This view has no cancel button. 7 | You should use this at very limited case. 8 | 9 | ## Screenshots 10 | ![Screen shot 1](./10fps.gif) 11 | ![Screen shot 2](./10fps-2.gif) 12 | ![Screen shot 3](./10fps-3.gif) 13 | 14 | ## Features 15 | This view has: 16 | - Circular activity view. 17 | - Circular progress view. 18 | - Label in center. 19 | - Transparent black effect covers all screen. 20 | 21 | This is: 22 | - Light. 23 | - Dynamic Type capable. 24 | - Fit to all screen size. 25 | - Easy to use. 26 | 27 | Animation is implemented at CALayer. 28 | 29 | ## How to Use 30 | 31 | You can use ProgressMaskView on Interface Builder or from code. 32 | 33 | ### Interface Builder 34 | Put a UIView and change its class to ProgressMaskView. 35 | 36 | 37 | **Notes:** 38 | - If you want to cover whole screen, you have to add a ProgressMaskView onto the UITabBarController or UINavigationBarController when you use it. 39 | - You should set `false` to `uninstall:` argument at `hide` function to avoid removing it from the view hierarchy. It is `true` by default. 40 | 41 | ### Code 42 | I suggest this way. 43 | Just pass the current view controller to the install(to:) function. This view will automatically insert itself into the appropriate position of the view hierarchy. If you use UITabBarController or UINavigationController, it will find these root view controller. 44 | At the end, this view will remove itself when `hide` is called. 45 | 46 | Refer to the sample code below. 47 | 48 | ## Customization 49 | - Change colors. 50 | - Change Radius and Thickness. 51 | - Change activity rotation speed. 52 | 53 | ## Installation 54 | 55 | ### CocoaPod 56 | Add one line to your Podfile. 57 | 58 | ```podfile 59 | pod 'ProgressMaskView' 60 | ``` 61 | Close Xcode, open Terminal, go to the folder contains the Pod file, and run `pod install`. 62 | 63 | ### Manually 64 | - Get all code. 65 | - Add the ProgressMaskView.xcodeproj onto your project. 66 | - Add ProgressMaskView.framework into the Embedded Binaries section at Project - Target - General. 67 | - `import ProgressMaskView` will enable you to use ProgressMaskView. 68 | 69 | ## Sample Code 70 | 71 | ### Start 72 | 73 | In your view controller; 74 | 75 | ```Swift 76 | 77 | import ProgressMaskView 78 | 79 | ... 80 | 81 | private var maskView: ProgressMaskView? 82 | 83 | ... 84 | 85 | @IBAction func onButtonTap(_ sender: Any) { 86 | guard maskView == nil else { return } 87 | 88 | maskView = ProgressMaskView() 89 | maskView?.title = "Processing..." 90 | maskView?.install(to: self) 91 | maskView?.show(in: 1.0) 92 | 93 | startYourProcess() 94 | } 95 | ``` 96 | 97 | ### Set Progress 98 | 99 | While processing, set progress value to ProgressMaskView to update display. 100 | 101 | ```Swift 102 | maskView?.progress = progressValue // 0.0 - 1.0 103 | ``` 104 | 105 | ### End 106 | 107 | At the end, call `hide` method to discard the view. 108 | 109 | ```Swift 110 | maskView?.hide(in: 1.0, uninstall: true) { 111 | self.maskView = nil 112 | } 113 | ``` 114 | 115 | If `uninstall:` argumate is `false`, The Progress Mask View become hidden but remains in the view hierarchy. You can reuse it by calling `show(in:)` method. 116 | 117 | ## License 118 | MIT License 119 | 120 | ## Thanks 121 | Any comments, requests, contributions are welcome. 122 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // TestProgressMaskView 4 | // 5 | // Created by eyteyt on 2020/02/13. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 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 | 22 | 23 | // MARK: UISceneSession Lifecycle 24 | 25 | @available(iOS 13.0, *) 26 | extension AppDelegate { 27 | 28 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 29 | // Called when a new scene session is being created. 30 | // Use this method to select a configuration to create the new scene with. 31 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 32 | } 33 | 34 | @available(iOS 13.0, *) 35 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 36 | // Called when the user discards a scene session. 37 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 38 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /TestProgressMaskViewApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /TestProgressMaskViewApp/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 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/Base.lproj/Main.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 | 27 | 28 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 127 | 133 | 134 | 135 | 136 | 137 | 138 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 162 | 168 | 169 | 170 | 171 | 172 | 173 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 210 | 216 | 217 | 218 | 219 | 220 | 221 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 245 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/CommonParts/ParameterControlView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ParameterControlView.swift 3 | // TestProgressMaskView 4 | // 5 | // Created by eytyet on 2020/02/14. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import ProgressMaskView 11 | 12 | @objc protocol ParameterControlViewDelegate: class { 13 | @objc optional func didColorChanged(_ parameterView: ParameterControlView, index: Int, color: UIColor) 14 | @objc optional func didBlendLevelChanged(_ parameterView: ParameterControlView, blendLevel: CGFloat) 15 | @objc optional func didWidthRatioChanged(_ parameterView: ParameterControlView, widthRatio: CGFloat) 16 | @objc optional func didRadiusRatioChanged(_ parameterView: ParameterControlView, radiusRatio: CGFloat) 17 | } 18 | 19 | class ParameterControlView: UIView { 20 | 21 | @IBOutlet var backgroundView: SimpleRView! 22 | @IBOutlet weak var titleLabel: UILabel! 23 | @IBOutlet weak var color1View: SimpleRView! 24 | @IBOutlet weak var color2View: SimpleRView! 25 | @IBOutlet weak var blendLabel: UILabel! 26 | @IBOutlet weak var blendSlider: UISlider! 27 | @IBOutlet weak var radiusSliderView: UISlider! 28 | @IBOutlet weak var radiusValue: UILabel! 29 | @IBOutlet weak var widthSliderView: UISlider! 30 | @IBOutlet weak var widthValue: UILabel! 31 | 32 | public weak var delegate: ParameterControlViewDelegate? 33 | 34 | /// Title string 35 | public var title: String { 36 | get { titleLabel.text ?? "" } 37 | set { titleLabel.text = newValue } 38 | } 39 | 40 | /// Return parameter set 41 | public var parameters: ProgressMaskBarParameter { 42 | return ProgressMaskBarParameter(color1: color1View.backgroundColor!, color2: color2View.backgroundColor!, blend: CGFloat(blendSlider!.value), widthRatio: CGFloat(widthSliderView!.value), radiusRatio: CGFloat(radiusSliderView!.value)) 43 | } 44 | 45 | private var _backgroundColor: UIColor? 46 | 47 | // MARK: - Initialization 48 | 49 | override init(frame: CGRect) { 50 | super.init(frame: frame) 51 | initialSetup() 52 | } 53 | 54 | required init?(coder: NSCoder) { 55 | super.init(coder: coder) 56 | initialSetup() 57 | } 58 | 59 | private func initialSetup() { 60 | // load xib 61 | let nib = UINib(nibName: "ParameterControlView", bundle: nil) 62 | guard let view = nib.instantiate(withOwner: self).first as? UIView else { 63 | fatalError("Can't load ParameterControlView.xib") 64 | } 65 | view.translatesAutoresizingMaskIntoConstraints = false 66 | addSubviewWithConstraints(view) 67 | 68 | // setup UI 69 | blendSlider.minimumValue = 0 70 | blendSlider.maximumValue = 1.0 71 | blendSlider.value = 0.5 72 | blendLabel.text = "0.5" 73 | widthSliderView.minimumValue = 0 74 | widthSliderView.maximumValue = 1.0 75 | widthSliderView.value = 0.1 76 | widthValue.text = "0.10" 77 | radiusSliderView.minimumValue = 0 78 | radiusSliderView.maximumValue = 0.5 79 | radiusSliderView.value = 0.5 80 | radiusValue.text = "0.50" 81 | } 82 | 83 | // MARK: - UIView 84 | 85 | /// IB set this backgroundColor and then set backgroundView.backgroundColor. Therefore, the specified background color is removed. So, keep it on _backgroundColor. 86 | override var backgroundColor: UIColor? { 87 | get { backgroundView?.backgroundColor } 88 | set { 89 | _backgroundColor = newValue 90 | backgroundView?.backgroundColor = newValue 91 | } 92 | } 93 | 94 | override func awakeFromNib() { 95 | if let color = _backgroundColor { 96 | backgroundView.backgroundColor = color 97 | } 98 | } 99 | 100 | override func prepareForInterfaceBuilder() { 101 | // Avoid 0 width on title. 102 | if let view = titleLabel.superview { 103 | view.addConstraint(view.widthAnchor.constraint(equalToConstant: 30)) 104 | } 105 | if let color = _backgroundColor { 106 | backgroundView.backgroundColor = color 107 | } 108 | } 109 | 110 | // MARK: - Actions 111 | 112 | @IBAction func onColor1Tap(_ sender: Any) { 113 | let color = UIColor.random 114 | UIView.animate(withDuration: 0.2) { 115 | self.color1View.backgroundColor = color 116 | } 117 | delegate?.didColorChanged?(self, index: 1, color: color) 118 | } 119 | 120 | @IBAction func onColor2Tap(_ sender: Any) { 121 | let color = UIColor.random 122 | UIView.animate(withDuration: 0.2) { 123 | self.color2View.backgroundColor = color 124 | } 125 | delegate?.didColorChanged?(self, index: 2, color: color) 126 | } 127 | 128 | @IBAction func onRadiusChanged(_ sender: UISlider) { 129 | let value = sender.value 130 | radiusValue.text = value.decimal(2) 131 | delegate?.didRadiusRatioChanged?(self, radiusRatio: CGFloat(value)) 132 | } 133 | 134 | @IBAction func onWidthChanged(_ sender: UISlider) { 135 | let value = sender.value 136 | widthValue.text = value.decimal(2) 137 | delegate?.didWidthRatioChanged?(self, widthRatio: CGFloat(value)) 138 | } 139 | 140 | @IBAction func onBlendChanged(_ sender: UISlider) { 141 | let value = sender.value 142 | blendLabel.text = value.decimal(2) 143 | delegate?.didBlendLevelChanged?(self, blendLevel: CGFloat(value)) 144 | } 145 | 146 | // MARK: - Methods 147 | 148 | func setParameter(color1: UIColor? = nil, color2: UIColor? = nil, blendLevel: CGFloat? = nil, radiusRatio: CGFloat? = nil, widthRatio: CGFloat? = nil) { 149 | if let color = color1 { 150 | color1View.backgroundColor = color 151 | } 152 | if let color = color2 { 153 | color2View.backgroundColor = color 154 | } 155 | if let blend = blendLevel { 156 | blendSlider.value = Float(blend) 157 | blendLabel.text = blend.decimal(2) 158 | } 159 | if let radius = radiusRatio { 160 | let value = Float(radius) 161 | radiusSliderView.value = value 162 | radiusValue.text = value.decimal(2) 163 | } 164 | if let width = widthRatio { 165 | widthSliderView.value = Float(width) 166 | widthValue.text = width.decimal(2) 167 | } 168 | } 169 | 170 | 171 | } 172 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/CommonParts/ParameterControlView.xib: -------------------------------------------------------------------------------- 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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 166 | 167 | 168 | 169 | 170 | 171 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/CommonParts/SidewayView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SidewayView.swift 3 | // TestProgressMaskView 4 | // 5 | // Created by eytyet on 2020/02/14. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | /// Rotate subview in right angle. 12 | @IBDesignable 13 | public class SidewayView: UIView { 14 | 15 | /// For convenience initializer 16 | public enum Angle { 17 | case clockwise 18 | case counterClockwise 19 | case upsideDown 20 | case normal 21 | var isRightAngle: Bool { 22 | self == .clockwise || self == .counterClockwise 23 | } 24 | } 25 | 26 | /// Angle of this view. 27 | private(set) var angle = Angle.normal 28 | 29 | /// Resize ratio 30 | private(set) var scale: CGFloat = 1.0 31 | 32 | /// Set for clockwise or upsideDown 33 | @IBInspectable var isClockwise: Bool = false { 34 | didSet { updateAngle() } 35 | } 36 | /// Set for couunterClockwise or upsideDown 37 | @IBInspectable var isCounterClockwise: Bool = false { 38 | didSet { updateAngle() } 39 | } 40 | 41 | /// Helper to get child view size. 42 | private var childSize: CGSize? { subviews.first?.intrinsicContentSize } 43 | 44 | /// Helper to get child view size. 45 | private var childView: UIView? { subviews.first } 46 | 47 | /// Receive size order and manage child size. 48 | public override var bounds: CGRect { 49 | get { super.bounds } 50 | set { 51 | super.bounds = newValue 52 | // Pass the size to child view. 53 | var size = newValue.size 54 | if angle.isRightAngle { 55 | swap(&size.width, &size.height) 56 | } 57 | guard let originalSize = childSize else { return } 58 | scale = min(size.width / originalSize.width, size.height / originalSize.height, 1) // No enlargement 59 | if let child = childView { 60 | applyAngle(child) 61 | } 62 | } 63 | } 64 | 65 | // MARK: - Initialize 66 | 67 | private override init(frame: CGRect) { 68 | super.init(frame: frame) 69 | } 70 | 71 | required init?(coder: NSCoder) { 72 | super.init(coder: coder) 73 | } 74 | 75 | convenience init(view: UIView, angle: Angle) { 76 | self.init(frame: CGRect.zero) 77 | switch angle { 78 | case .clockwise: 79 | isClockwise = true 80 | isCounterClockwise = false 81 | case .counterClockwise: 82 | isClockwise = false 83 | isCounterClockwise = true 84 | case .upsideDown: 85 | isClockwise = true 86 | isCounterClockwise = true 87 | case .normal: 88 | isClockwise = false 89 | isCounterClockwise = false 90 | } 91 | } 92 | 93 | // MARK: - UIView 94 | 95 | public override class var requiresConstraintBasedLayout: Bool { true } 96 | 97 | public override var intrinsicContentSize: CGSize { 98 | let size = super.intrinsicContentSize 99 | guard var childSize = childSize else { return size } 100 | if angle.isRightAngle { swap(&childSize.width, &childSize.height) } 101 | return childSize 102 | } 103 | 104 | /// Only one subview is allowed. 105 | override public func addSubview(_ view: UIView) { 106 | subviews.forEach { (view) in 107 | view.removeFromSuperview() 108 | } 109 | super.addSubview(view) 110 | applyAngle(view) 111 | } 112 | 113 | public override func layoutSubviews() { 114 | super.layoutSubviews() 115 | // if rotated, origin of child view is incorrectly moved. Adjust it to zero. 116 | if angle.isRightAngle, let child = childView { 117 | child.frame.origin = CGPoint.zero 118 | } 119 | } 120 | 121 | public override func prepareForInterfaceBuilder() { 122 | if let child = subviews.first { 123 | applyAngle(child) 124 | } 125 | } 126 | 127 | // MARK: - Methods 128 | 129 | private func updateAngle() { 130 | switch (isClockwise, isCounterClockwise) { 131 | case (true, false): 132 | angle = .clockwise 133 | case (false, true): 134 | angle = .counterClockwise 135 | case (true, true): 136 | angle = .upsideDown 137 | case (false, false): 138 | angle = .normal 139 | } 140 | if let view = subviews.first { 141 | applyAngle(view) 142 | } 143 | } 144 | 145 | private func applyAngle(_ view: UIView) { 146 | let transform = CGAffineTransform.identity.scaledBy(x: scale, y: scale) 147 | switch angle { 148 | case .normal: 149 | view.transform = transform 150 | case .upsideDown: 151 | view.transform = transform.rotated(by: .pi) 152 | case .clockwise: 153 | view.transform = transform.rotated(by: .pi / -2) 154 | case .counterClockwise: 155 | view.transform = transform.rotated(by: .pi / 2) 156 | } 157 | invalidateIntrinsicContentSize() 158 | setNeedsLayout() 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/CommonParts/SimpleRView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleRView.swift 3 | // ProgressMaskView 4 | // 5 | // Created by eytyet on 2019/07/07. 6 | // Copyright © 2019 Yu Software. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | @IBDesignable 13 | class SimpleRView: UIView { 14 | @IBInspectable var cornerRadius : CGFloat { 15 | get { layer.cornerRadius } 16 | set { layer.cornerRadius = newValue } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/Extensions/BinaryFloatingPointExtensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BinaryFloatingPointExtensions.swift 3 | // TestProgressMaskView 4 | // 5 | // Created by eytyet on 2020/02/14. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension BinaryFloatingPoint { 12 | /// Returns string description. 13 | func decimal(_ count: Int) -> String { 14 | let value = Double(self) 15 | return String(format: "%.\(count)f", value) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/Extensions/CGFloatExtensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGFloatExtensions.swift 3 | // TestProgressMaskView 4 | // 5 | // Created by eytyet on 2020/02/14. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension CGFloat { 12 | /// Return a random value between 0 to 1. 13 | static var random: CGFloat { .random(in: 0 ... 1) } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/Extensions/UIColorExtensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIColorExtensions.swift 3 | // TestProgressMaskView 4 | // 5 | // Created by eytyet on 2020/02/14. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIColor { 12 | /// Return a random color 13 | static var random: UIColor { 14 | UIColor(red: .random, green: .random, blue: .random, alpha: 1) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/Extensions/UIViewExtensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewExtensions.swift 3 | // TestProgressMaskView 4 | // 5 | // Created by eytyet on 2020/02/14. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIView { 12 | /// Add subview and set constraints with optional insets. 13 | public func addSubviewWithConstraints(_ view: UIView, insets: UIEdgeInsets = UIEdgeInsets.zero) { 14 | view.translatesAutoresizingMaskIntoConstraints = false 15 | addSubview(view) 16 | NSLayoutConstraint.activate([ 17 | view.topAnchor.constraint(equalTo: topAnchor, constant: insets.top), 18 | view.centerYAnchor.constraint(equalTo: centerYAnchor, constant: (insets.top - insets.bottom) / 2), 19 | view.leadingAnchor.constraint(equalTo: leadingAnchor, constant: insets.left), 20 | view.centerXAnchor.constraint(equalTo: centerXAnchor, constant: (insets.left - insets.right) / 2) 21 | ]) 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/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 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIApplicationSceneManifest 45 | 46 | UIApplicationSupportsMultipleScenes 47 | 48 | UISceneConfigurations 49 | 50 | UIWindowSceneSessionRoleApplication 51 | 52 | 53 | UISceneDelegateClassName 54 | $(PRODUCT_MODULE_NAME).SceneDelegate 55 | UISceneConfigurationName 56 | Default Configuration 57 | UISceneStoryboardFile 58 | Main 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/MainTableViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MainTableViewController.swift 3 | // TestProgressMaskView 4 | // 5 | // Created by eytyet on 2020/02/14. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class MainTableViewController: UITableViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | } 16 | 17 | // MARK: - Table view data source 18 | 19 | override func numberOfSections(in tableView: UITableView) -> Int { 20 | return 2 21 | } 22 | 23 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 24 | return 1 25 | } 26 | 27 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 28 | tableView.deselectRow(at: indexPath, animated: true) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/ParameterDemoViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ParameterDemoViewController.swift 3 | // TestProgressMaskView 4 | // 5 | // Created by eytyet on 2020/02/14. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import ProgressMaskView 11 | 12 | class ParameterDemoViewController: UIViewController { 13 | 14 | @IBOutlet weak var progressMaskView: ProgressMaskView! 15 | 16 | @IBOutlet weak var activityControllerView: ParameterControlView! { 17 | didSet { 18 | activityControllerView.delegate = self 19 | activityControllerView.title = "Activity Bar" 20 | activityControllerView.setParameter(color1: .red, color2: .yellow, blendLevel: 0.5, radiusRatio: 0.5, widthRatio: 0.1) 21 | } 22 | } 23 | 24 | @IBOutlet weak var progressControllerView: ParameterControlView! { 25 | didSet { 26 | progressControllerView.delegate = self 27 | progressControllerView.title = "Progress Bar" 28 | progressControllerView.setParameter(color1: .blue, color2: .cyan, blendLevel: 1.0, radiusRatio: 0.4, widthRatio: 0.2) 29 | } 30 | } 31 | 32 | // MARK: - Private properties 33 | 34 | private var sampleProcess: SampleProcess? 35 | 36 | // MARK: - UIViewController 37 | 38 | override func viewWillAppear(_ animated: Bool) { 39 | super.viewDidAppear(animated) 40 | startJob() 41 | } 42 | 43 | // MRAK: - Methods 44 | 45 | private func startJob() { 46 | guard sampleProcess == nil else { return } 47 | 48 | progressMaskView.progress = 0 49 | progressMaskView.setParameters(bar: .activity, parameter: activityControllerView.parameters) 50 | progressMaskView.setParameters(bar: .progress, parameter: progressControllerView.parameters) 51 | progressMaskView.show(in: 1.0) 52 | 53 | sampleProcess = SampleProcess() 54 | sampleProcess?.delegate = self 55 | sampleProcess?.startJob() 56 | } 57 | } 58 | 59 | // MARK: - Parameter Control View Delegate 60 | 61 | extension ParameterDemoViewController: ParameterControlViewDelegate { 62 | func didColorChanged(_ parameterView: ParameterControlView, index: Int, color: UIColor) { 63 | if parameterView.tag == 1 { // Activity Bar 64 | if index == 1 { 65 | progressMaskView.activityColor1 = color 66 | } 67 | if index == 2 { 68 | progressMaskView.activityColor2 = color 69 | } 70 | } else { // Progress Bar 71 | if index == 1 { 72 | progressMaskView.progressColor1 = color 73 | } 74 | if index == 2 { 75 | progressMaskView.progressColor2 = color 76 | } 77 | } 78 | startJob() 79 | } 80 | 81 | func didBlendLevelChanged(_ parameterView: ParameterControlView, blendLevel: CGFloat) { 82 | if parameterView.tag == 1 { // Activity Bar 83 | progressMaskView.activityBlendLevel = blendLevel 84 | } else { // Progress Bar 85 | progressMaskView.progressBlendLevel = blendLevel 86 | } 87 | startJob() 88 | } 89 | 90 | func didWidthRatioChanged(_ parameterView: ParameterControlView, widthRatio: CGFloat) { 91 | if parameterView.tag == 1 { // Activity Bar 92 | progressMaskView.activityWidthRatio = widthRatio 93 | } else { // Progress Bar 94 | progressMaskView.progressWidthRatio = widthRatio 95 | } 96 | startJob() 97 | } 98 | 99 | func didRadiusRatioChanged(_ parameterView: ParameterControlView, radiusRatio: CGFloat) { 100 | if parameterView.tag == 1 { // Activity Bar 101 | progressMaskView.activityRadiusRatio = radiusRatio 102 | } else { // Progress Bar 103 | progressMaskView.progressRadiusRatio = radiusRatio 104 | } 105 | startJob() 106 | } 107 | } 108 | 109 | // MARK: - Sample Process Delegate 110 | 111 | extension ParameterDemoViewController: SampleProcessDelegate { 112 | func notify(progress: Float) { 113 | progressMaskView.progress = progress 114 | } 115 | 116 | func notify(completion: Bool) { 117 | progressMaskView.hide(in: 1.0, uninstall: false) { 118 | self.sampleProcess = nil 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/RandamDemoViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // TestProgressMaskView 4 | // 5 | // Created by eytyet on 2020/02/13. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import ProgressMaskView 11 | 12 | class RandamDemoViewController: UIViewController { 13 | 14 | @IBOutlet weak var activityColor1View: UIView! 15 | @IBOutlet weak var activityColor2View: UIView! 16 | @IBOutlet weak var activityBlendLabel: UILabel! 17 | @IBOutlet weak var activityRadiusLabel: UILabel! 18 | @IBOutlet weak var activityWidthLabel: UILabel! 19 | 20 | @IBOutlet weak var progressColor1View: UIView! 21 | @IBOutlet weak var progressColor2View: UIView! 22 | @IBOutlet weak var progressBlendLabel: UILabel! 23 | @IBOutlet weak var progressRadiusLabel: UILabel! 24 | @IBOutlet weak var progressWidthLabel: UILabel! 25 | 26 | private var progressMaskView: ProgressMaskView? 27 | private var timer: Timer? 28 | private var progress = Float.zero 29 | private var random: CGFloat { .random(in: 0 ... 1) } 30 | 31 | // MARK: - Lifecycle 32 | 33 | override func viewDidLoad() { 34 | super.viewDidLoad() 35 | // Do any additional setup after loading the view. 36 | } 37 | 38 | override func viewWillAppear(_ animated: Bool) { 39 | startDemo() 40 | } 41 | 42 | // MARK: - Methods 43 | 44 | private func startDemo() { 45 | progressMaskView = makeProgressMaskView() 46 | progress = 0 47 | showParameters(progressMaskView!) 48 | 49 | let recognizer = UITapGestureRecognizer(target: self, action: #selector(onTap)) 50 | progressMaskView?.addGestureRecognizer(recognizer) 51 | 52 | // start timer to proceed the progress. 53 | timer = Timer(timeInterval: 0.1, target: self, selector: #selector(proceed), userInfo: nil, repeats: true) 54 | RunLoop.main.add(timer!, forMode: .default) 55 | timer?.fire() 56 | } 57 | 58 | private func makeProgressMaskView() -> ProgressMaskView { 59 | let view = ProgressMaskView() 60 | 61 | view.title = "Test..." 62 | view.activityColor1 = .random 63 | view.activityColor2 = .random 64 | view.activityBlendLevel = .random 65 | view.activityRadiusRatio = 0.5//random / 3 + 0.1 66 | view.activityWidthRatio = .random / 3 + 0.15 67 | view.progressColor1 = .random 68 | view.progressColor2 = .random 69 | view.progressBlendLevel = .random / 2 + 0.5 70 | view.progressRadiusRatio = .random / 4 + 0.25 71 | view.progressWidthRatio = .random / 4 + 0.25 72 | 73 | // Call from non-main thread to reproduce bug #3. 74 | DispatchQueue.global().async { 75 | view.install(to: self) 76 | view.show(in: 1.0) 77 | } 78 | return view 79 | } 80 | 81 | private func showParameters(_ view: ProgressMaskView) { 82 | //display 83 | activityColor1View.backgroundColor = view.activityColor1 84 | activityColor2View.backgroundColor = view.activityColor2 85 | activityBlendLabel.text = String(format: "%.2f", view.activityBlendLevel) 86 | activityRadiusLabel.text = "Radius ratio =" + String(format: "%.2f", view.activityRadiusRatio) 87 | activityWidthLabel.text = "Width ratio =" + String(format: "%.2f", view.activityWidthRatio) 88 | progressColor1View.backgroundColor = view.progressColor1 89 | progressColor2View.backgroundColor = view.progressColor2 90 | progressBlendLabel.text = String(format: "%.2f", view.progressBlendLevel) 91 | progressRadiusLabel.text = "Radius ratio =" + String(format: "%.2f", view.progressRadiusRatio) 92 | progressWidthLabel.text = "Width ratio =" + String(format: "%.2f", view.progressWidthRatio) 93 | } 94 | 95 | @objc func proceed() { 96 | guard let progressMaskView = progressMaskView else { return } 97 | 98 | progress += Float.random(in: 0 ..< 0.01) 99 | if progress > 1 { 100 | progress = 1 101 | progressMaskView.progress = progress 102 | progressMaskView.hide(in: 1.0, uninstall: true) { 103 | self.progressMaskView = nil 104 | self.startDemo() 105 | } 106 | timer?.invalidate() 107 | timer = nil 108 | return 109 | } 110 | progressMaskView.progress = progress 111 | } 112 | 113 | /// Called on tap 114 | @objc func onTap(_ sender: UITapGestureRecognizer) { 115 | progress = 1 // end current progress. 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/SampleProcess.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SampleProcess.swift 3 | // TestProgressMaskViewApp 4 | // 5 | // Created by Yu Software on 2020/02/15. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// To notify progress of the job. 12 | protocol SampleProcessDelegate: class { 13 | func notify(progress: Float) 14 | func notify(completion: Bool) 15 | } 16 | 17 | /// A dummy job process proceeded by timer. 18 | class SampleProcess { 19 | 20 | weak var delegate: SampleProcessDelegate? 21 | 22 | private let repeatInterval: TimeInterval = 0.1 23 | 24 | private(set) var progress: Float = 0 25 | 26 | private var timer: Timer? 27 | 28 | func startJob() { 29 | progress = 0 30 | startTimer() 31 | } 32 | 33 | func endJob() { 34 | endTimer() 35 | } 36 | 37 | private func startTimer() { 38 | guard timer == nil else { return } 39 | let timer = Timer(timeInterval: repeatInterval, target: self, selector: #selector(proceed), userInfo: nil, repeats: true) 40 | self.timer = timer 41 | RunLoop.main.add(timer, forMode: .default) 42 | timer.fire() 43 | } 44 | 45 | private func endTimer() { 46 | guard let timer = timer else { return } 47 | timer.invalidate() 48 | self.timer = nil 49 | } 50 | 51 | deinit { 52 | endTimer() 53 | } 54 | 55 | /// Proceed the job progress 56 | @objc func proceed() { 57 | progress += Float.random(in: 0 ... 0.02 ) 58 | 59 | if progress < 1 { 60 | delegate?.notify(progress: progress) 61 | return 62 | } 63 | endTimer() 64 | progress = 1 65 | delegate?.notify(completion: true) 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /TestProgressMaskViewApp/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // TestProgressMaskView 4 | // 5 | // Created by eytyet on 2020/02/13. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | @available(iOS 13.0, *) 13 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | 18 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 19 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 20 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 21 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 22 | guard let _ = (scene as? UIWindowScene) else { return } 23 | } 24 | 25 | func sceneDidDisconnect(_ scene: UIScene) { 26 | // Called as the scene is being released by the system. 27 | // This occurs shortly after the scene enters the background, or when its session is discarded. 28 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 29 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 30 | } 31 | 32 | func sceneDidBecomeActive(_ scene: UIScene) { 33 | // Called when the scene has moved from an inactive state to an active state. 34 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 35 | } 36 | 37 | func sceneWillResignActive(_ scene: UIScene) { 38 | // Called when the scene will move from an active state to an inactive state. 39 | // This may occur due to temporary interruptions (ex. an incoming phone call). 40 | } 41 | 42 | func sceneWillEnterForeground(_ scene: UIScene) { 43 | // Called as the scene transitions from the background to the foreground. 44 | // Use this method to undo the changes made on entering the background. 45 | } 46 | 47 | func sceneDidEnterBackground(_ scene: UIScene) { 48 | // Called as the scene transitions from the foreground to the background. 49 | // Use this method to save data, release shared resources, and store enough scene-specific state information 50 | // to restore the scene back to its current state. 51 | } 52 | 53 | 54 | } 55 | 56 | -------------------------------------------------------------------------------- /TestProgressMaskViewAppTests/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 | -------------------------------------------------------------------------------- /TestProgressMaskViewAppTests/TestProgressMaskViewTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestProgressMaskViewTests.swift 3 | // TestProgressMaskViewTests 4 | // 5 | // Created by eytyet on 2020/02/13. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import TestProgressMaskViewApp 11 | 12 | class TestProgressMaskViewTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testScope() { 23 | /*// Could not be built with lines below 24 | let _ = LineArcRotateView() 25 | let _ = LineArcView() 26 | let _ = LoatateLayer() 27 | let _ = ArcShape() 28 | */ 29 | } 30 | 31 | func testPerformanceExample() { 32 | // This is an example of a performance test case. 33 | self.measure { 34 | // Put the code you want to measure the time of here. 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /TestProgressMaskViewAppUITests/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 | -------------------------------------------------------------------------------- /TestProgressMaskViewAppUITests/TestProgressMaskViewUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestProgressMaskViewUITests.swift 3 | // TestProgressMaskViewUITests 4 | // 5 | // Created by eytyet on 2020/02/13. 6 | // Copyright © 2020 Yu Software. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class TestProgressMaskViewUITests: XCTestCase { 12 | 13 | override func setUp() { 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 tearDown() { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | } 25 | 26 | func testExample() { 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() { 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 | --------------------------------------------------------------------------------