Skip to content

Commit

Permalink
Merge pull request #7 from Pidji/master
Browse files Browse the repository at this point in the history
Changed readme
  • Loading branch information
Pidji authored Jun 28, 2018
2 parents 546920b + 32d3cb0 commit b4a53fb
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 27 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file modified Example/.DS_Store
Binary file not shown.
Binary file not shown.
34 changes: 23 additions & 11 deletions Example/Hash2Pics/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,12 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="qXI-4I-Woq">
<rect key="frame" x="87" y="233" width="200" height="200"/>
<rect key="frame" x="87" y="263.5" width="200" height="200"/>
<constraints>
<constraint firstAttribute="width" constant="200" id="Luu-5Z-PH1"/>
<constraint firstAttribute="width" secondItem="qXI-4I-Woq" secondAttribute="height" multiplier="1:1" id="Un7-Qn-zQz"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="gtS-Wl-IBy">
<rect key="frame" x="16" y="204" width="343" height="21"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JU6-au-67u">
<rect key="frame" x="112" y="587" width="150" height="60"/>
<constraints>
Expand All @@ -50,26 +44,44 @@
<action selector="nextAction:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="SkD-jw-69p"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="chevron" translatesAutoresizingMaskIntoConstraints="NO" id="d1o-2U-POb">
<rect key="frame" x="175" y="222.5" width="25" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="25" id="KgY-Jg-3TA"/>
<constraint firstAttribute="height" constant="25" id="zgJ-A0-heQ"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="gtS-Wl-IBy" userLabel="Hash Label">
<rect key="frame" x="16" y="185.5" width="343" height="21"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.011764705882352941" green="0.49803921568627452" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="JU6-au-67u" secondAttribute="bottom" constant="20" id="FVQ-cY-1EK"/>
<constraint firstItem="gtS-Wl-IBy" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="XmN-0T-RAy"/>
<constraint firstItem="qXI-4I-Woq" firstAttribute="top" secondItem="d1o-2U-POb" secondAttribute="bottom" constant="16" id="g1j-i5-CK6"/>
<constraint firstItem="qXI-4I-Woq" firstAttribute="centerX" secondItem="kh9-bI-dsS" secondAttribute="centerX" id="hgt-IO-9SJ"/>
<constraint firstItem="qXI-4I-Woq" firstAttribute="top" secondItem="gtS-Wl-IBy" secondAttribute="bottom" constant="8" id="peX-fu-ynU"/>
<constraint firstItem="qXI-4I-Woq" firstAttribute="centerY" secondItem="kh9-bI-dsS" secondAttribute="centerY" id="qqt-Wu-S0M"/>
<constraint firstItem="d1o-2U-POb" firstAttribute="centerX" secondItem="qXI-4I-Woq" secondAttribute="centerX" id="i57-Fp-32e"/>
<constraint firstItem="qXI-4I-Woq" firstAttribute="centerY" secondItem="kh9-bI-dsS" secondAttribute="centerY" constant="30" id="qqt-Wu-S0M"/>
<constraint firstItem="d1o-2U-POb" firstAttribute="top" secondItem="gtS-Wl-IBy" secondAttribute="bottom" constant="16" id="rXk-gU-5cX"/>
<constraint firstItem="JU6-au-67u" firstAttribute="centerX" secondItem="kh9-bI-dsS" secondAttribute="centerX" id="tFU-nJ-Qfr"/>
<constraint firstItem="gtS-Wl-IBy" firstAttribute="trailing" secondItem="kh9-bI-dsS" secondAttribute="trailingMargin" id="zJR-Cw-z8R"/>
</constraints>
</view>
<connections>
<outlet property="addressLabel" destination="gtS-Wl-IBy" id="Wxw-kd-g6O"/>
<outlet property="avatarImageView" destination="qXI-4I-Woq" id="fia-sh-xyy"/>
<outlet property="hashLabel" destination="gtS-Wl-IBy" id="edr-oA-y7f"/>
<outlet property="pictureImageView" destination="qXI-4I-Woq" id="fZr-C0-Feb"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="117.59999999999999" y="118.29085457271366"/>
</scene>
</scenes>
<resources>
<image name="chevron" width="25" height="25"/>
</resources>
</document>
6 changes: 6 additions & 0 deletions Example/Hash2Pics/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
23 changes: 23 additions & 0 deletions Example/Hash2Pics/Images.xcassets/chevron.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icons8-down_filled-2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "icons8-down_filled-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "icons8-down_filled.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 12 additions & 11 deletions Example/Hash2Pics/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import UIKit
import Hash2Pics

class ViewController: UIViewController {
@IBOutlet weak var addressLabel: UILabel!
@IBOutlet weak var avatarImageView: UIImageView!

@IBOutlet weak var pictureImageView: UIImageView!
@IBOutlet weak var hashLabel: UILabel!

let addresses = ["1KpCMHzox8ykqUbPXvZQeFNLhk1VT52SA3",

let hashList = ["1KpCMHzox8ykqUbPXvZQeFNLhk1VT52SA3",
"1MHFB1WdnAcGhny6gmBPBom3k2tzwx9odK",
"155fiyuVUZBKokthobpV15wX2tWcnx4QJV",
"13a9pYjsDHn1BbDp5xCGNpUhBKzP3DnYmS",
Expand Down Expand Up @@ -168,21 +169,21 @@ class ViewController: UIViewController {
}

func updateUI() {
let address = addresses[currentIndex]
addressLabel.text = address
let hash = hashList[currentIndex]
hashLabel.text = hash

let ava = PictureConstructor().createPicture(diameter: avatarImageView.frame.size.width, seed: addresses[currentIndex])
guard ava != nil else {
let pic = PictureConstructor().createPicture(diameter: pictureImageView.frame.size.width, seed: hash)
guard pic != nil else {
return
}

avatarImageView.image = ava!
avatarImageView.layer.shadowRadius = 10
avatarImageView.layer.shadowOpacity = 0.5
pictureImageView.image = pic!
pictureImageView.layer.shadowRadius = 10
pictureImageView.layer.shadowOpacity = 0.5
}

@IBAction func nextAction(_ sender: Any) {
if currentIndex == (addresses.count - 1) {
if currentIndex == (hashList.count - 1) {
currentIndex = 0
} else {
currentIndex += 1
Expand Down
Binary file added Hash2Pics/.DS_Store
Binary file not shown.
Binary file added Images/.DS_Store
Binary file not shown.
Binary file added Images/h2p.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
[![License](https://img.shields.io/cocoapods/l/Hash2Pics.svg?style=flat)](https://cocoapods.org/pods/Hash2Pics)
[![Platform](https://img.shields.io/cocoapods/p/Hash2Pics.svg?style=flat)](https://cocoapods.org/pods/Hash2Pics)

## Example

To run the example project, clone the repo, and run `pod install` from the Example directory first.
<img src="https://raw.githubusercontent.com/Multy-io/Hash2Pics-IOS/master/Images/h2p.gif" width="342" height="320" />

## Requirements

Expand All @@ -25,9 +23,21 @@ it, simply add the following line to your Podfile:
pod 'Hash2Pics'
```

## Author
## Usage

Simply pass hash and diameter to create picture

```
let pic = PictureConstructor().createPicture(diameter: 200, seed: "YOUR_HASH")
```

## Example

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Authors

Pidji, [email protected]
This library developed by guys from Multy - best open-source multy-blockchain wallet, [email protected]

## License

Expand Down

0 comments on commit b4a53fb

Please sign in to comment.