         }
         let view = elements[0].0
         let numbers = elements[0].1
-        let key = vflKey(view)
-        viewDict[key] = view
-        metricDict = numbers.metricDict
+        let key = vflKey(view) as NSString
+        viewMap.setObject(view, forKey: key)
+        metricMap = numbers.metricMap
         if numbers.isWrapped {
             self.format = "[\(key)\(numbers.format)]"
         } else {
             self.format = "[\(key)(\(numbers.format))]"
         }
     }
-    
-    // ExpressibleByFloatLiteral, ExpressibleByIntegerLiteral
-    var metricDict = [String: NSNumber]()
+}
+
+extension VFLComponent: ExpressibleByFloatLiteral, ExpressibleByIntegerLiteral {
     public typealias FloatLiteralType = Double
     public init(floatLiteral value: FloatLiteralType) {
         let number = value as NSNumber
         let key = vflKey(number)
-        metricDict[key] = number
+        metricMap.setObject(number, forKey: key as NSString)
         self.format = key
     }
     public typealias IntegerLiteralType = Int
     public init(integerLiteral value: IntegerLiteralType) {
         let number = value as NSNumber
         let key = vflKey(number)
-        metricDict[vflKey(number)] = number
+        metricMap.setObject(number, forKey: key as NSString)
         self.format = key
     }
     
 }
 
-private extension VFLComponent {
-    var isWrapped: Bool {
+extension VFLComponent {
+    fileprivate var isWrapped: Bool {
         return self.format.hasPrefix("(") && self.format.hasSuffix(")")
     }
+
+    private func vflDictionary<T>(_ table: NSMapTable<NSString, T>) -> [String : AnyObject] {
+        var dictionary = [String : AnyObject]()
+        for key in table.keyEnumerator().allObjects {
+            let key = key as! NSString
+            dictionary[key as String] = table.object(forKey: key)
+        }
+        return dictionary
+    }
+
+    /// Returns layout constraints with options.
+    public func constraints(axis: UILayoutConstraintAxis, options: NSLayoutFormatOptions) -> [NSLayoutConstraint] {
+        /// fail it if views are changed in case of the weak pointers' targets being deallocated
+        let keyCount = viewMap.keyEnumerator().allObjects.count
+        guard let viewCount = viewMap.objectEnumerator()?.allObjects.count, keyCount == viewCount else { return [] }
+        let axisPrefix: String
+        switch axis {
+        case .horizontal: axisPrefix = "H:"
+        case .vertical:   axisPrefix = "V:"
+        }
+        return NSLayoutConstraint.constraints(withVisualFormat: axisPrefix + format, options: options, metrics: vflDictionary(metricMap), views: vflDictionary(viewMap))
+    }
+    
 }
+
 
 // MARK: - operators
 

    return "A\(UInt(bitPattern: Unmanaged.passUnretained(object).toOpaque().hashValue))B"
}

public struct VFLComponent: ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral, ExpressibleByFloatLiteral, ExpressibleByIntegerLiteral {
    public var format = ""
    
    // ExpressibleByArrayLiteral
    var viewDict = [String: UIView]()
    public typealias Element = UIView
    public init(arrayLiteral elements: Element...) {
        guard elements.count == 1 else {
            fatalError("view component can contains only one UIView instance: \(elements)")
        }
        let view = elements[0]
        let key = vflKey(view)
        viewDict[key] = view
        self.format = "[\(key)]"
    }
    
    // ExpressibleByDictionaryLiteral
    public typealias Key = UIView
    public typealias Value = VFLComponent
    public init(dictionaryLiteral elements: (Key, Value)...) {


extension Array where Element: NSLayoutConstraint {
    public init(H: VFLComponent, options: NSLayoutFormatOptions = []) {
        self = H.constraints(axis: .horizontal, options: options) as! [Element]
    }
    public init(V: VFLComponent, options: NSLayoutFormatOptions = []) {
        self = V.constraints(axis: .vertical, options: options) as! [Element]
    }
}
