mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			14 lines
		
	
	
		
			495 B
		
	
	
	
		
			Swift
		
	
		
		
			
		
	
	
			14 lines
		
	
	
		
			495 B
		
	
	
	
		
			Swift
		
	
| 
								 
											6 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								@objc(LKIdenticon)
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								public final class Identicon : NSObject {
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								    
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								    @objc public static func generateIcon(string: String, size: CGFloat) -> UIImage {
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								        let icon = JazzIcon(seed: string)
							 | 
						||
| 
								 | 
							
								        let iconLayer = icon.generateLayer(ofSize: size)
							 | 
						||
| 
								 | 
							
								        let rect = CGRect(origin: CGPoint.zero, size: iconLayer.frame.size)
							 | 
						||
| 
								 | 
							
								        let renderer = UIGraphicsImageRenderer(size: rect.size)
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								        let image = renderer.image { iconLayer.render(in: $0.cgContext) }
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								        return image
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |