Skip to content

Commit

Permalink
Merge pull request #1 from ArcBlock/no-anim-feat
Browse files Browse the repository at this point in the history
feat: add animated param
  • Loading branch information
karthuszY authored Jun 28, 2022
2 parents c9822a7 + 0a45c3f commit 4047b22
Show file tree
Hide file tree
Showing 8 changed files with 223 additions and 42 deletions.
91 changes: 91 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/did-motif-ios.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "did-motif-ios"
BuildableName = "did-motif-ios"
BlueprintName = "did-motif-ios"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "did-motif-iosTests"
BuildableName = "did-motif-iosTests"
BlueprintName = "did-motif-iosTests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "did-motif-iosTests"
BuildableName = "did-motif-iosTests"
BlueprintName = "did-motif-iosTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "did-motif-ios"
BuildableName = "did-motif-ios"
BlueprintName = "did-motif-ios"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
132 changes: 109 additions & 23 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,23 @@
1ABE84AB27E824D500F86D65 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1ABE84A927E824D500F86D65 /* Main.storyboard */; };
1ABE84AD27E824D700F86D65 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1ABE84AC27E824D700F86D65 /* Assets.xcassets */; };
1ABE84B027E824D700F86D65 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1ABE84AE27E824D700F86D65 /* LaunchScreen.storyboard */; };
1ABE84B927E8254300F86D65 /* did-motif-ios in Frameworks */ = {isa = PBXBuildFile; productRef = 1ABE84B827E8254300F86D65 /* did-motif-ios */; };
1AEE1F30286AF939008AAF5A /* UIColor+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F1D286AF939008AAF5A /* UIColor+Extension.swift */; };
1AEE1F31286AF939008AAF5A /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F1E286AF939008AAF5A /* String+Extension.swift */; };
1AEE1F32286AF939008AAF5A /* Data+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F1F286AF939008AAF5A /* Data+Extension.swift */; };
1AEE1F33286AF939008AAF5A /* Array+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F20286AF939008AAF5A /* Array+Extension.swift */; };
1AEE1F34286AF939008AAF5A /* DIDRoleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F21286AF939008AAF5A /* DIDRoleType.swift */; };
1AEE1F35286AF939008AAF5A /* DIDMotifView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F22286AF939008AAF5A /* DIDMotifView.swift */; };
1AEE1F36286AF939008AAF5A /* Encoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F24286AF939008AAF5A /* Encoding.swift */; };
1AEE1F37286AF939008AAF5A /* Base64String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F25286AF939008AAF5A /* Base64String.swift */; };
1AEE1F38286AF939008AAF5A /* Base16String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F26286AF939008AAF5A /* Base16String.swift */; };
1AEE1F39286AF939008AAF5A /* Multibase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F27286AF939008AAF5A /* Multibase.swift */; };
1AEE1F3A286AF939008AAF5A /* Base58String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F28286AF939008AAF5A /* Base58String.swift */; };
1AEE1F3B286AF939008AAF5A /* Base16.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F2A286AF939008AAF5A /* Base16.swift */; };
1AEE1F3C286AF939008AAF5A /* Base32.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F2B286AF939008AAF5A /* Base32.swift */; };
1AEE1F3D286AF939008AAF5A /* shim.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F2C286AF939008AAF5A /* shim.swift */; };
1AEE1F3E286AF939008AAF5A /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F2D286AF939008AAF5A /* StringExtension.swift */; };
1AEE1F3F286AF939008AAF5A /* Base32String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F2E286AF939008AAF5A /* Base32String.swift */; };
1AEE1F40286AF939008AAF5A /* DIDMotifUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AEE1F2F286AF939008AAF5A /* DIDMotifUtils.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -25,14 +41,30 @@
1ABE84AC27E824D700F86D65 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
1ABE84AF27E824D700F86D65 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
1ABE84B127E824D700F86D65 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1AEE1F1D286AF939008AAF5A /* UIColor+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Extension.swift"; sourceTree = "<group>"; };
1AEE1F1E286AF939008AAF5A /* String+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = "<group>"; };
1AEE1F1F286AF939008AAF5A /* Data+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Data+Extension.swift"; sourceTree = "<group>"; };
1AEE1F20286AF939008AAF5A /* Array+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Array+Extension.swift"; sourceTree = "<group>"; };
1AEE1F21286AF939008AAF5A /* DIDRoleType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DIDRoleType.swift; sourceTree = "<group>"; };
1AEE1F22286AF939008AAF5A /* DIDMotifView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DIDMotifView.swift; sourceTree = "<group>"; };
1AEE1F24286AF939008AAF5A /* Encoding.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Encoding.swift; sourceTree = "<group>"; };
1AEE1F25286AF939008AAF5A /* Base64String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Base64String.swift; sourceTree = "<group>"; };
1AEE1F26286AF939008AAF5A /* Base16String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Base16String.swift; sourceTree = "<group>"; };
1AEE1F27286AF939008AAF5A /* Multibase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Multibase.swift; sourceTree = "<group>"; };
1AEE1F28286AF939008AAF5A /* Base58String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Base58String.swift; sourceTree = "<group>"; };
1AEE1F2A286AF939008AAF5A /* Base16.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Base16.swift; sourceTree = "<group>"; };
1AEE1F2B286AF939008AAF5A /* Base32.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Base32.swift; sourceTree = "<group>"; };
1AEE1F2C286AF939008AAF5A /* shim.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = shim.swift; sourceTree = "<group>"; };
1AEE1F2D286AF939008AAF5A /* StringExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringExtension.swift; sourceTree = "<group>"; };
1AEE1F2E286AF939008AAF5A /* Base32String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Base32String.swift; sourceTree = "<group>"; };
1AEE1F2F286AF939008AAF5A /* DIDMotifUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DIDMotifUtils.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
1ABE849D27E824D500F86D65 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1ABE84B927E8254300F86D65 /* did-motif-ios in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -58,6 +90,7 @@
1ABE84A227E824D500F86D65 /* Example */ = {
isa = PBXGroup;
children = (
1AEE1F1A286AF939008AAF5A /* Sources */,
1ABE84A327E824D500F86D65 /* AppDelegate.swift */,
1ABE84A527E824D500F86D65 /* SceneDelegate.swift */,
1ABE84A727E824D500F86D65 /* ViewController.swift */,
Expand All @@ -69,6 +102,63 @@
path = Example;
sourceTree = "<group>";
};
1AEE1F1A286AF939008AAF5A /* Sources */ = {
isa = PBXGroup;
children = (
1AEE1F1B286AF939008AAF5A /* did-motif-ios */,
);
name = Sources;
path = ../../Sources;
sourceTree = "<group>";
};
1AEE1F1B286AF939008AAF5A /* did-motif-ios */ = {
isa = PBXGroup;
children = (
1AEE1F1C286AF939008AAF5A /* Extension */,
1AEE1F21286AF939008AAF5A /* DIDRoleType.swift */,
1AEE1F22286AF939008AAF5A /* DIDMotifView.swift */,
1AEE1F23286AF939008AAF5A /* Multibase */,
1AEE1F2F286AF939008AAF5A /* DIDMotifUtils.swift */,
);
path = "did-motif-ios";
sourceTree = "<group>";
};
1AEE1F1C286AF939008AAF5A /* Extension */ = {
isa = PBXGroup;
children = (
1AEE1F1D286AF939008AAF5A /* UIColor+Extension.swift */,
1AEE1F1E286AF939008AAF5A /* String+Extension.swift */,
1AEE1F1F286AF939008AAF5A /* Data+Extension.swift */,
1AEE1F20286AF939008AAF5A /* Array+Extension.swift */,
);
path = Extension;
sourceTree = "<group>";
};
1AEE1F23286AF939008AAF5A /* Multibase */ = {
isa = PBXGroup;
children = (
1AEE1F24286AF939008AAF5A /* Encoding.swift */,
1AEE1F25286AF939008AAF5A /* Base64String.swift */,
1AEE1F26286AF939008AAF5A /* Base16String.swift */,
1AEE1F27286AF939008AAF5A /* Multibase.swift */,
1AEE1F28286AF939008AAF5A /* Base58String.swift */,
1AEE1F29286AF939008AAF5A /* Base32 */,
1AEE1F2E286AF939008AAF5A /* Base32String.swift */,
);
path = Multibase;
sourceTree = "<group>";
};
1AEE1F29286AF939008AAF5A /* Base32 */ = {
isa = PBXGroup;
children = (
1AEE1F2A286AF939008AAF5A /* Base16.swift */,
1AEE1F2B286AF939008AAF5A /* Base32.swift */,
1AEE1F2C286AF939008AAF5A /* shim.swift */,
1AEE1F2D286AF939008AAF5A /* StringExtension.swift */,
);
path = Base32;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand All @@ -86,7 +176,6 @@
);
name = Example;
packageProductDependencies = (
1ABE84B827E8254300F86D65 /* did-motif-ios */,
);
productName = Example;
productReference = 1ABE84A027E824D500F86D65 /* Example.app */;
Expand Down Expand Up @@ -117,7 +206,6 @@
);
mainGroup = 1ABE849727E824D500F86D65;
packageReferences = (
1ABE84B727E8254300F86D65 /* XCRemoteSwiftPackageReference "did-motif-ios" */,
);
productRefGroup = 1ABE84A127E824D500F86D65 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -146,9 +234,26 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1AEE1F3F286AF939008AAF5A /* Base32String.swift in Sources */,
1AEE1F39286AF939008AAF5A /* Multibase.swift in Sources */,
1ABE84A827E824D500F86D65 /* ViewController.swift in Sources */,
1AEE1F34286AF939008AAF5A /* DIDRoleType.swift in Sources */,
1ABE84A427E824D500F86D65 /* AppDelegate.swift in Sources */,
1AEE1F3A286AF939008AAF5A /* Base58String.swift in Sources */,
1AEE1F37286AF939008AAF5A /* Base64String.swift in Sources */,
1AEE1F35286AF939008AAF5A /* DIDMotifView.swift in Sources */,
1AEE1F3C286AF939008AAF5A /* Base32.swift in Sources */,
1ABE84A627E824D500F86D65 /* SceneDelegate.swift in Sources */,
1AEE1F31286AF939008AAF5A /* String+Extension.swift in Sources */,
1AEE1F36286AF939008AAF5A /* Encoding.swift in Sources */,
1AEE1F33286AF939008AAF5A /* Array+Extension.swift in Sources */,
1AEE1F3D286AF939008AAF5A /* shim.swift in Sources */,
1AEE1F30286AF939008AAF5A /* UIColor+Extension.swift in Sources */,
1AEE1F40286AF939008AAF5A /* DIDMotifUtils.swift in Sources */,
1AEE1F3E286AF939008AAF5A /* StringExtension.swift in Sources */,
1AEE1F38286AF939008AAF5A /* Base16String.swift in Sources */,
1AEE1F32286AF939008AAF5A /* Data+Extension.swift in Sources */,
1AEE1F3B286AF939008AAF5A /* Base16.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -368,25 +473,6 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
1ABE84B727E8254300F86D65 /* XCRemoteSwiftPackageReference "did-motif-ios" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/ArcBlock/did-motif-ios";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
1ABE84B827E8254300F86D65 /* did-motif-ios */ = {
isa = XCSwiftPackageProductDependency;
package = 1ABE84B727E8254300F86D65 /* XCRemoteSwiftPackageReference "did-motif-ios" */;
productName = "did-motif-ios";
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 1ABE849827E824D500F86D65 /* Project object */;
}

This file was deleted.

1 change: 0 additions & 1 deletion Example/Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//

import UIKit
import did_motif_ios

class ViewController: UIViewController {

Expand Down
4 changes: 4 additions & 0 deletions MyPlayground.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import UIKit

let result = [1, 2, 3].filter({ $0 == 1 })
print(result)
4 changes: 4 additions & 0 deletions MyPlayground.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios' buildActiveScheme='true' importAppTypes='true'>
<timeline fileName='timeline.xctimeline'/>
</playground>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions Sources/did-motif-ios/DIDMotifView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class DIDMotifView: UIView {
// 若未设置,则shape默认为address解出来的
private var shape: DIDMotifShage?

// 是否播放动画
private var animated: Bool = true

// MARK: - Properties
private lazy var shapeLayer: CAShapeLayer = {
let layer = CAShapeLayer()
Expand Down Expand Up @@ -110,7 +113,9 @@ extension DIDMotifView {
subLayer.fillColor = UIColor(white: 1, alpha: 0.3).cgColor
let point = points?.objectAtIndexSafely(index: index) ?? CGPoint.zero
subLayer.position = point
subLayer.add(animTo(point: point), forKey: "move")
if animated {
subLayer.add(animTo(point: point), forKey: "move")
}
}
}

Expand Down Expand Up @@ -144,9 +149,10 @@ extension DIDMotifView {

// MARK: Public
extension DIDMotifView {
public func renderWith(address: String, shape: DIDMotifShage?) {
public func renderWith(address: String, shape: DIDMotifShage?, animated: Bool = true) {
self.address = address
self.shape = shape
self.animated = animated

decodeAddress()
}
Expand Down

0 comments on commit 4047b22

Please sign in to comment.