{"id":9022,"date":"2023-11-07T14:58:46","date_gmt":"2023-11-07T06:58:46","guid":{"rendered":"https:\/\/1989lifejourney.com\/?p=9022"},"modified":"2023-11-08T16:48:36","modified_gmt":"2023-11-08T08:48:36","slug":"ios-swift-opaque-type","status":"publish","type":"post","link":"https:\/\/1989lifejourney.com\/?p=9022","title":{"rendered":"IOS Swift Opaque type"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<ul class=\"has-medium-font-size wp-block-list\">\n<li><strong>Prerequisite<\/strong><\/li>\n\n\n\n<li><strong>The Problem That Opaque Types Solve<\/strong><\/li>\n\n\n\n<li><strong>Opaque type v.s. Generic type<\/strong><\/li>\n\n\n\n<li><strong>Opaque type v.s. boxed protocol type<\/strong><\/li>\n\n\n\n<li><strong>Generics type\u3001Opaque type\u3001Boxed protocol type<\/strong><\/li>\n\n\n\n<li><strong>Opaque type\u6703\u4fdd\u7559\u539f\u59cbtype identity<\/strong><\/li>\n\n\n\n<li><strong>SwiftUI\u904b\u7528Opaque type\u4f8b\u5b50<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Prerequisite<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Swift\u63d0\u4f9b\u5169\u7a2evalue type\u4f86\u96b1\u85cf\u5be6\u4f5c\u7d30\u7bc0:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Opaque type<\/li>\n\n\n\n<li>Boxed protocol type<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note 1:<br><\/strong>\u901a\u5e38\u5728module\u548cclient\u4e4b\u9593\u6703\u96b1\u85cftype\u8cc7\u8a0a\uff0c\u56e0\u70baclient\u7aef\u4e0d\u9700\u8981\u77e5\u9053module\u5167\u7684private type<br><strong>Note 2:<br><\/strong>Opaque types\u4fdd\u7559type identity(p.s. compiler\u80fd\u77e5\u9053type\u8cc7\u8a0a\uff0c\u4f46\u662fclient\u7aef\u4e0d\u77e5\u9053)<br>Boxed types\u6c92\u6709\u4fdd\u7559type identity(p.s. compiler\u4e0d\u77e5\u9053type\u8cc7\u8a0a\uff0c\u76f4\u5230runtime\u57f7\u884c\u6642\u624d\u6703\u77e5\u9053)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4f8b\u5982:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler\"><div class=\"wp-block-embed__wrapper\">\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist126084043\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-opaque_type_vs_boxed_type-swift\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-swift  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"opaque_type_vs_boxed_type.swift content, created by tgnivekucn on 05:49AM on November 08, 2023.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"opaque_type_vs_boxed_type.swift\">\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC1\" class=\"blob-code blob-code-inner js-file-line\">protocol Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC2\" class=\"blob-code blob-code-inner js-file-line\">    associatedtype T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC3\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC4\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC5\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC6\" class=\"blob-code blob-code-inner js-file-line\">struct Triangle: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC7\" class=\"blob-code blob-code-inner js-file-line\">    typealias T = Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC8\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC9\" class=\"blob-code blob-code-inner js-file-line\">    var size: Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC10\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC11\" class=\"blob-code blob-code-inner js-file-line\">       var result: [String] = []<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC12\" class=\"blob-code blob-code-inner js-file-line\">       for length in 1...size {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC13\" class=\"blob-code blob-code-inner js-file-line\">           result.append(String(repeating: &quot;*&quot;, count: length))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC14\" class=\"blob-code blob-code-inner js-file-line\">       }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC15\" class=\"blob-code blob-code-inner js-file-line\">       return result.joined(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC16\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC17\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC18\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC19\" class=\"blob-code blob-code-inner js-file-line\">struct Square: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC20\" class=\"blob-code blob-code-inner js-file-line\">    typealias T = Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC21\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC22\" class=\"blob-code blob-code-inner js-file-line\">    var size: Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC23\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC24\" class=\"blob-code blob-code-inner js-file-line\">        let line = String(repeating: &quot;*&quot;, count: size)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC25\" class=\"blob-code blob-code-inner js-file-line\">        let result = Array&lt;String&gt;(repeating: line, count: size)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC26\" class=\"blob-code blob-code-inner js-file-line\">        return result.joined(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC27\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC28\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC29\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC30\" class=\"blob-code blob-code-inner js-file-line\">\/\/ Opaque types<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L31\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"31\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC31\" class=\"blob-code blob-code-inner js-file-line\">\/\/ Compile error: Conflicting arguments to generic parameter &#39;\u03c4_0_0&#39; (&#39;Square&#39; vs. &#39;Triangle&#39;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L32\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"32\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC32\" class=\"blob-code blob-code-inner js-file-line\">var tmp1: [some Shape] = [Square(size: 1), Triangle(size: 1)] \/\/[Square(size: 1), Square(size: 2)]<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L33\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"33\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC33\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L34\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"34\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC34\" class=\"blob-code blob-code-inner js-file-line\">\/\/ Boxed types<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L35\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"35\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC35\" class=\"blob-code blob-code-inner js-file-line\">var tmp2: [any Shape] = [Square(size: 1), Triangle(size: 1)]<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/tgnivekucn\/b331dd260eb87ff296303994525f6314\/raw\/c53e30045a30aedfe230318eb528b9fedbf84f8e\/opaque_type_vs_boxed_type.swift\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/tgnivekucn\/b331dd260eb87ff296303994525f6314#file-opaque_type_vs_boxed_type-swift\" class=\"Link--inTextBlock\">\n          opaque_type_vs_boxed_type.swift\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<\/div><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">The Problem That Opaque Types Solve<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u5011\u53ea\u5728\u4e4efunction\u56de\u50b3\u7684\u7d50\u679c\u662f<br>The code inside the module could build up the same shape in a variety of ways, and other code outside the module that uses the shape shouldn\u2019t have to account for the implementation details<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4f8b\u5982:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler\"><div class=\"wp-block-embed__wrapper\">\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist126084285\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-opaque_type_hide_information_from_module-swift\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-swift  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"opaque_type_hide_information_from_module.swift content, created by tgnivekucn on 05:57AM on November 08, 2023.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"opaque_type_hide_information_from_module.swift\">\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC1\" class=\"blob-code blob-code-inner js-file-line\">protocol Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC2\" class=\"blob-code blob-code-inner js-file-line\">    associatedtype T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC3\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC4\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC5\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC6\" class=\"blob-code blob-code-inner js-file-line\">struct Triangle: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC7\" class=\"blob-code blob-code-inner js-file-line\">    typealias T = Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC8\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC9\" class=\"blob-code blob-code-inner js-file-line\">    var size: Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC10\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC11\" class=\"blob-code blob-code-inner js-file-line\">       var result: [String] = []<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC12\" class=\"blob-code blob-code-inner js-file-line\">       for length in 1...size {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC13\" class=\"blob-code blob-code-inner js-file-line\">           result.append(String(repeating: &quot;*&quot;, count: length))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC14\" class=\"blob-code blob-code-inner js-file-line\">       }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC15\" class=\"blob-code blob-code-inner js-file-line\">       return result.joined(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC16\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC17\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC18\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC19\" class=\"blob-code blob-code-inner js-file-line\">struct Square: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC20\" class=\"blob-code blob-code-inner js-file-line\">    typealias T = Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC21\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC22\" class=\"blob-code blob-code-inner js-file-line\">    var size: Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC23\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC24\" class=\"blob-code blob-code-inner js-file-line\">        let line = String(repeating: &quot;*&quot;, count: size)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC25\" class=\"blob-code blob-code-inner js-file-line\">        let result = Array&lt;String&gt;(repeating: line, count: size)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC26\" class=\"blob-code blob-code-inner js-file-line\">        return result.joined(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC27\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC28\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC29\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC30\" class=\"blob-code blob-code-inner js-file-line\">struct FlippedShape&lt;T: Shape&gt;: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L31\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"31\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC31\" class=\"blob-code blob-code-inner js-file-line\">    var shape: T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L32\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"32\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC32\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L33\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"33\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC33\" class=\"blob-code blob-code-inner js-file-line\">        let lines = shape.draw().split(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L34\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"34\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC34\" class=\"blob-code blob-code-inner js-file-line\">        return lines.reversed().joined(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L35\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"35\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC35\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L36\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"36\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC36\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L37\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"37\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC37\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L38\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"38\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC38\" class=\"blob-code blob-code-inner js-file-line\">struct JoinedShape&lt;T: Shape, U: Shape&gt;: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L39\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"39\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC39\" class=\"blob-code blob-code-inner js-file-line\">    var top: T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L40\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"40\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC40\" class=\"blob-code blob-code-inner js-file-line\">    var bottom: U<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L41\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"41\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC41\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L42\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"42\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC42\" class=\"blob-code blob-code-inner js-file-line\">       return top.draw() + &quot;\\n&quot; + bottom.draw()<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L43\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"43\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC43\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L44\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"44\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC44\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L45\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"45\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC45\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L46\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"46\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC46\" class=\"blob-code blob-code-inner js-file-line\">func makeTrapezoid() -&gt; some Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L47\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"47\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC47\" class=\"blob-code blob-code-inner js-file-line\">    let top = Triangle(size: 2)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L48\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"48\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC48\" class=\"blob-code blob-code-inner js-file-line\">    let middle = Square(size: 2)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L49\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"49\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC49\" class=\"blob-code blob-code-inner js-file-line\">    let bottom = FlippedShape(shape: top)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L50\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"50\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC50\" class=\"blob-code blob-code-inner js-file-line\">    let trapezoid = JoinedShape(top: top,<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L51\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"51\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC51\" class=\"blob-code blob-code-inner js-file-line\">                                bottom: JoinedShape(top: middle, bottom: bottom))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L52\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"52\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC52\" class=\"blob-code blob-code-inner js-file-line\">    return trapezoid<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L53\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"53\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC53\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L54\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"54\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC54\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L55\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"55\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC55\" class=\"blob-code blob-code-inner js-file-line\">\/\/ Below is client<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L56\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"56\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC56\" class=\"blob-code blob-code-inner js-file-line\">let myShape = makeTrapezoid()<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L57\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"57\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC57\" class=\"blob-code blob-code-inner js-file-line\">let drawResult = myShape.draw()<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-L58\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"58\"><\/td>\n          <td id=\"file-opaque_type_hide_information_from_module-swift-LC58\" class=\"blob-code blob-code-inner js-file-line\">print(drawResult)<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/tgnivekucn\/2394ee4b6753b01ef3d7a26c2f35c1f9\/raw\/81e02ed77925752404bb70a96efc4c21d54a0ac5\/opaque_type_hide_information_from_module.swift\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/tgnivekucn\/2394ee4b6753b01ef3d7a26c2f35c1f9#file-opaque_type_hide_information_from_module-swift\" class=\"Link--inTextBlock\">\n          opaque_type_hide_information_from_module.swift\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<\/div><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Opaque type v.s. Generic type<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Generic type:<\/strong> Let caller pick the type for that function&#8217;s parameters and return value<br><strong>Opaque type:<\/strong> The function implementation decides the return value&#8217;s type<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example of Generic type let caller decide the type of function&#8217;s parameters and return value:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func max&lt;T&gt;(_ x: T, _ y: T) -&gt; T where T: Comparable { ... }<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example of Opaque type decided by function implementation:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler\"><div class=\"wp-block-embed__wrapper\">\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist126085073\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-opaque_type_decided_by_function_implementation-swift\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-swift  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"opaque_type_decided_by_function_implementation.swift content, created by tgnivekucn on 06:28AM on November 08, 2023.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"opaque_type_decided_by_function_implementation.swift\">\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC1\" class=\"blob-code blob-code-inner js-file-line\">public protocol Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC2\" class=\"blob-code blob-code-inner js-file-line\">    associatedtype T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC3\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC4\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC5\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC6\" class=\"blob-code blob-code-inner js-file-line\">struct Triangle: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC7\" class=\"blob-code blob-code-inner js-file-line\">    typealias T = Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC8\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC9\" class=\"blob-code blob-code-inner js-file-line\">    var size: Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC10\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC11\" class=\"blob-code blob-code-inner js-file-line\">       var result: [String] = []<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC12\" class=\"blob-code blob-code-inner js-file-line\">       for length in 1...size {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC13\" class=\"blob-code blob-code-inner js-file-line\">           result.append(String(repeating: &quot;*&quot;, count: length))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC14\" class=\"blob-code blob-code-inner js-file-line\">       }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC15\" class=\"blob-code blob-code-inner js-file-line\">       return result.joined(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC16\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC17\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC18\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC19\" class=\"blob-code blob-code-inner js-file-line\">struct Square: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC20\" class=\"blob-code blob-code-inner js-file-line\">    typealias T = Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC21\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC22\" class=\"blob-code blob-code-inner js-file-line\">    var size: Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC23\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC24\" class=\"blob-code blob-code-inner js-file-line\">        let line = String(repeating: &quot;*&quot;, count: size)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC25\" class=\"blob-code blob-code-inner js-file-line\">        let result = Array&lt;String&gt;(repeating: line, count: size)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC26\" class=\"blob-code blob-code-inner js-file-line\">        return result.joined(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC27\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC28\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC29\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC30\" class=\"blob-code blob-code-inner js-file-line\">struct FlippedShape&lt;T: Shape&gt;: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L31\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"31\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC31\" class=\"blob-code blob-code-inner js-file-line\">    var shape: T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L32\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"32\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC32\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L33\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"33\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC33\" class=\"blob-code blob-code-inner js-file-line\">        let lines = shape.draw().split(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L34\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"34\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC34\" class=\"blob-code blob-code-inner js-file-line\">        return lines.reversed().joined(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L35\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"35\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC35\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L36\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"36\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC36\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L37\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"37\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC37\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L38\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"38\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC38\" class=\"blob-code blob-code-inner js-file-line\">struct JoinedShape&lt;T: Shape, U: Shape&gt;: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L39\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"39\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC39\" class=\"blob-code blob-code-inner js-file-line\">    var top: T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L40\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"40\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC40\" class=\"blob-code blob-code-inner js-file-line\">    var bottom: U<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L41\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"41\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC41\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L42\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"42\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC42\" class=\"blob-code blob-code-inner js-file-line\">       return top.draw() + &quot;\\n&quot; + bottom.draw()<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L43\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"43\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC43\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L44\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"44\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC44\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L45\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"45\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC45\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L46\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"46\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC46\" class=\"blob-code blob-code-inner js-file-line\">public func makeTrapezoid() -&gt; some Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L47\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"47\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC47\" class=\"blob-code blob-code-inner js-file-line\">    let top = Square(size: 3) \/\/ Triangle(size: 2)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L48\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"48\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC48\" class=\"blob-code blob-code-inner js-file-line\">    let middle = Square(size: 2)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L49\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"49\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC49\" class=\"blob-code blob-code-inner js-file-line\">    let bottom = FlippedShape(shape: top)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L50\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"50\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC50\" class=\"blob-code blob-code-inner js-file-line\">    let trapezoid = JoinedShape(top: top,<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L51\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"51\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC51\" class=\"blob-code blob-code-inner js-file-line\">                                bottom: JoinedShape(top: middle, bottom: bottom)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L52\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"52\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC52\" class=\"blob-code blob-code-inner js-file-line\">                                )<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L53\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"53\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC53\" class=\"blob-code blob-code-inner js-file-line\">    print(trapezoid.self) \/\/ the type is decided by what types you used to create JoinedShape<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L54\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"54\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC54\" class=\"blob-code blob-code-inner js-file-line\">    return trapezoid<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L55\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"55\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC55\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-L56\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"56\"><\/td>\n          <td id=\"file-opaque_type_decided_by_function_implementation-swift-LC56\" class=\"blob-code blob-code-inner js-file-line\">   <\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/tgnivekucn\/5a4a9212843a5308e42a179efdd25e9e\/raw\/ebf22496449828f4a6ba070422ed75e6c0f0434b\/opaque_type_decided_by_function_implementation.swift\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/tgnivekucn\/5a4a9212843a5308e42a179efdd25e9e#file-opaque_type_decided_by_function_implementation-swift\" class=\"Link--inTextBlock\">\n          opaque_type_decided_by_function_implementation.swift\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Opaque type v.s. boxed protocol type<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Opaque type:<br><\/strong>\u5728opaque type array\u5167\u7684\u6bcf\u500belement\u90fd\u662f\u76f8\u540c\u7684type\uff0c\u4e14\u9019\u500btype\u9075\u5b88\u6307\u5b9a\u7684protocol<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Opaque type array example:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler\"><div class=\"wp-block-embed__wrapper\">\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist126084043\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-opaque_type_vs_boxed_type-swift\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-swift  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"opaque_type_vs_boxed_type.swift content, created by tgnivekucn on 05:49AM on November 08, 2023.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"opaque_type_vs_boxed_type.swift\">\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC1\" class=\"blob-code blob-code-inner js-file-line\">protocol Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC2\" class=\"blob-code blob-code-inner js-file-line\">    associatedtype T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC3\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC4\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC5\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC6\" class=\"blob-code blob-code-inner js-file-line\">struct Triangle: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC7\" class=\"blob-code blob-code-inner js-file-line\">    typealias T = Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC8\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC9\" class=\"blob-code blob-code-inner js-file-line\">    var size: Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC10\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC11\" class=\"blob-code blob-code-inner js-file-line\">       var result: [String] = []<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC12\" class=\"blob-code blob-code-inner js-file-line\">       for length in 1...size {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC13\" class=\"blob-code blob-code-inner js-file-line\">           result.append(String(repeating: &quot;*&quot;, count: length))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC14\" class=\"blob-code blob-code-inner js-file-line\">       }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC15\" class=\"blob-code blob-code-inner js-file-line\">       return result.joined(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC16\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC17\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC18\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC19\" class=\"blob-code blob-code-inner js-file-line\">struct Square: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC20\" class=\"blob-code blob-code-inner js-file-line\">    typealias T = Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC21\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC22\" class=\"blob-code blob-code-inner js-file-line\">    var size: Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC23\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC24\" class=\"blob-code blob-code-inner js-file-line\">        let line = String(repeating: &quot;*&quot;, count: size)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC25\" class=\"blob-code blob-code-inner js-file-line\">        let result = Array&lt;String&gt;(repeating: line, count: size)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC26\" class=\"blob-code blob-code-inner js-file-line\">        return result.joined(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC27\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC28\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC29\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC30\" class=\"blob-code blob-code-inner js-file-line\">\/\/ Opaque types<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L31\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"31\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC31\" class=\"blob-code blob-code-inner js-file-line\">\/\/ Compile error: Conflicting arguments to generic parameter &#39;\u03c4_0_0&#39; (&#39;Square&#39; vs. &#39;Triangle&#39;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L32\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"32\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC32\" class=\"blob-code blob-code-inner js-file-line\">var tmp1: [some Shape] = [Square(size: 1), Triangle(size: 1)] \/\/[Square(size: 1), Square(size: 2)]<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L33\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"33\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC33\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L34\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"34\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC34\" class=\"blob-code blob-code-inner js-file-line\">\/\/ Boxed types<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-L35\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"35\"><\/td>\n          <td id=\"file-opaque_type_vs_boxed_type-swift-LC35\" class=\"blob-code blob-code-inner js-file-line\">var tmp2: [any Shape] = [Square(size: 1), Triangle(size: 1)]<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/tgnivekucn\/b331dd260eb87ff296303994525f6314\/raw\/c53e30045a30aedfe230318eb528b9fedbf84f8e\/opaque_type_vs_boxed_type.swift\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/tgnivekucn\/b331dd260eb87ff296303994525f6314#file-opaque_type_vs_boxed_type-swift\" class=\"Link--inTextBlock\">\n          opaque_type_vs_boxed_type.swift\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>boxed protocol type:<br><\/strong>\u5728boxed protocol type array\u5167\u7684\u6bcf\u500belement\u53ef\u4ee5\u662f\u4e0d\u540ctype\uff0c\u4f46\u6bcf\u500belement\u7684type\u90fd\u9075\u5b88\u6307\u5b9a\u7684protocol\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>boxed protocol type array example:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler\"><div class=\"wp-block-embed__wrapper\">\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist126085595\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-boxed_protocol_types_example-swift\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-swift  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"boxed_protocol_types_example.swift content, created by tgnivekucn on 06:43AM on November 08, 2023.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"boxed_protocol_types_example.swift\">\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC1\" class=\"blob-code blob-code-inner js-file-line\">public protocol Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC2\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC3\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC4\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC5\" class=\"blob-code blob-code-inner js-file-line\">struct Triangle: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC6\" class=\"blob-code blob-code-inner js-file-line\">    typealias T = Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC7\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC8\" class=\"blob-code blob-code-inner js-file-line\">    var size: Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC9\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC10\" class=\"blob-code blob-code-inner js-file-line\">       var result: [String] = []<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC11\" class=\"blob-code blob-code-inner js-file-line\">       for length in 1...size {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC12\" class=\"blob-code blob-code-inner js-file-line\">           result.append(String(repeating: &quot;*&quot;, count: length))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC13\" class=\"blob-code blob-code-inner js-file-line\">       }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC14\" class=\"blob-code blob-code-inner js-file-line\">       return result.joined(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC15\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC16\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC17\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC18\" class=\"blob-code blob-code-inner js-file-line\">struct Square: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC19\" class=\"blob-code blob-code-inner js-file-line\">    typealias T = Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC20\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC21\" class=\"blob-code blob-code-inner js-file-line\">    var size: Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC22\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC23\" class=\"blob-code blob-code-inner js-file-line\">        let line = String(repeating: &quot;*&quot;, count: size)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC24\" class=\"blob-code blob-code-inner js-file-line\">        let result = Array&lt;String&gt;(repeating: line, count: size)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC25\" class=\"blob-code blob-code-inner js-file-line\">        return result.joined(separator: &quot;\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC26\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC27\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC28\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC29\" class=\"blob-code blob-code-inner js-file-line\">struct VerticalShapes: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC30\" class=\"blob-code blob-code-inner js-file-line\">    var shapes: [any Shape] \/\/ boxed Shape elements by adding any before the name of a protocol<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L31\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"31\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC31\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L32\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"32\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC32\" class=\"blob-code blob-code-inner js-file-line\">        return shapes.map { $0.draw() }.joined(separator: &quot;\\n\\n&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L33\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"33\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC33\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L34\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"34\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC34\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L35\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"35\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC35\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L36\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"36\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC36\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L37\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"37\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC37\" class=\"blob-code blob-code-inner js-file-line\">let largeTriangle = Triangle(size: 5)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L38\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"38\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC38\" class=\"blob-code blob-code-inner js-file-line\">let largeSquare = Square(size: 5)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L39\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"39\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC39\" class=\"blob-code blob-code-inner js-file-line\">let vertical = VerticalShapes(shapes: [largeTriangle, largeSquare])<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-boxed_protocol_types_example-swift-L40\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"40\"><\/td>\n          <td id=\"file-boxed_protocol_types_example-swift-LC40\" class=\"blob-code blob-code-inner js-file-line\">print(vertical.draw())<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/tgnivekucn\/60974988ed282feb91fc58a2262feefe\/raw\/e6b3350efb704e5797ae314fee8549c05de133e2\/boxed_protocol_types_example.swift\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/tgnivekucn\/60974988ed282feb91fc58a2262feefe#file-boxed_protocol_types_example-swift\" class=\"Link--inTextBlock\">\n          boxed_protocol_types_example.swift\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Generics type\u3001Opaque type\u3001Boxed protocol type<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Contrast the three types you could use for shapes:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using generics, by writing struct VerticalShapes and var shapes: [S], makes an array whose elements are some specific shape type, and where the identity of that specific type is visible to any code that interacts with the array.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using an opaque type, by writing var shapes: [some Shape], makes an array whose elements are some specific shape type, and where that specific type\u2019s identity is hidden.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using a boxed protocol type, by writing var shapes: [any Shape], makes an array that can store elements of different types, and where those types\u2019 identities are hidden.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Opaque type\u6703\u4fdd\u7559\u539f\u59cbtype identity<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7576\u60f3\u8981\u7528protocol\u7576return type\u6642\uff0c\u5982\u679cprotocol\u672c\u8eab\u6709associative type\u3002\u6b64\u6642\uff0c\u5c31\u7121\u6cd5\u4f7f\u7528protocol\u7576return type\u3002\u9019\u6642\u5982\u679c\u6709\u4f7f\u7528Opaque type\uff0c\u5247compiler\u4e0d\u6703\u8df3\u51fa\u932f\u8aa4\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Opaque type retain type identity example:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler\"><div class=\"wp-block-embed__wrapper\">\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist126086178\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-opaque_type_retain_type_identity-swift\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-swift  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"opaque_type_retain_type_identity.swift content, created by tgnivekucn on 07:26AM on November 08, 2023.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"opaque_type_retain_type_identity.swift\">\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC1\" class=\"blob-code blob-code-inner js-file-line\">public protocol Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC2\" class=\"blob-code blob-code-inner js-file-line\">    associatedtype T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC3\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC4\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC5\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC6\" class=\"blob-code blob-code-inner js-file-line\">class Triangle: Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC7\" class=\"blob-code blob-code-inner js-file-line\">    typealias T = Int<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC8\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC9\" class=\"blob-code blob-code-inner js-file-line\">    func draw() -&gt; String {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC10\" class=\"blob-code blob-code-inner js-file-line\">        return &quot;Triangle&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC11\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC12\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC13\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC14\" class=\"blob-code blob-code-inner js-file-line\">\/\/ Boxed type<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC15\" class=\"blob-code blob-code-inner js-file-line\">func makeTrapezoid1() -&gt; any Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC16\" class=\"blob-code blob-code-inner js-file-line\">    let triangle = Triangle()<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC17\" class=\"blob-code blob-code-inner js-file-line\">    return triangle<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC18\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC19\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC20\" class=\"blob-code blob-code-inner js-file-line\">\/\/ Opaque type retain type identity example<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC21\" class=\"blob-code blob-code-inner js-file-line\">func makeTrapezoid2() -&gt; some Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC22\" class=\"blob-code blob-code-inner js-file-line\">    let triangle = Triangle()<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC23\" class=\"blob-code blob-code-inner js-file-line\">    return triangle<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC24\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC25\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC26\" class=\"blob-code blob-code-inner js-file-line\">\/\/ compile error: use of protocol &#39;Shape&#39; as a type must be written &#39;any Shape&#39;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC27\" class=\"blob-code blob-code-inner js-file-line\">func makeTrapezoid3() -&gt; Shape {<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC28\" class=\"blob-code blob-code-inner js-file-line\">    let triangle = Triangle()<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC29\" class=\"blob-code blob-code-inner js-file-line\">    return triangle<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-opaque_type_retain_type_identity-swift-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-opaque_type_retain_type_identity-swift-LC30\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/tgnivekucn\/c141c1cd68d28e8172da588bb21d1813\/raw\/114d9d4fbd224e8ec063f7a918fb395de241b7e6\/opaque_type_retain_type_identity.swift\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/tgnivekucn\/c141c1cd68d28e8172da588bb21d1813#file-opaque_type_retain_type_identity-swift\" class=\"Link--inTextBlock\">\n          opaque_type_retain_type_identity.swift\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<br><\/strong>Boxed type\u4e5f\u6703\u8b93compiler\u4e0d\u6703\u8df3\u51fa\u932f\u8aa4\uff0c\u53ea\u662fboxed type\u4e0d\u6703\u4fdd\u7559type identity\uff0c\u6240\u4ee5\u76f4\u5230runtime\uff0c\u6211\u5011\u624d\u6703\u77e5\u9053value\u7684type\uff0c\u4e14\u5b83\u80fd\u5920\u96a8\u8457\u6642\u9593\u6539\u8b8a\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">SwiftUI\u904b\u7528Opaque type\u4f8b\u5b50\uff1a<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4f8b\u5b501:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>struct ContentView: View {\n    var body: some View {\n        VStack {\n            Text(\"Hello, world! (1)\")\n            Button(\"print my type\") {\n                print(type(of: self.body))\n            }\n            Text(\"Hello, world! (2)\")\n        }\n        .padding()\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u5370\u51fa\u4f86\u7684body type\u662f:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ModifiedContent&lt;VStack&lt;TupleView&lt;(Text, Button&lt;Text&gt;, Text)&gt;&gt;, _PaddingLayout&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4f8b\u5b502:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>struct ContentView: View {\n    var body: some View {\n        VStack {\n            Image(systemName: \"globe\")\n            Button(\"print my type\") {\n                print(type(of: self.body))\n            }\n            Image(systemName: \"globe\")\n        }\n        .padding()\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u5370\u51fa\u4f86\u7684body type\u662f:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ModifiedContent&lt;VStack&lt;TupleView&lt;(Image, Button&lt;Text&gt;, Image)&gt;&gt;, _PaddingLayout&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ref:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/ejameslin.github.io\/Opaque-return-types\/\">https:\/\/ejameslin.github.io\/Opaque-return-types\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/dsrijan.medium.com\/opaque-type-in-swift-4015aeeca1ac\">https:\/\/dsrijan.medium.com\/opaque-type-in-swift-4015aeeca1ac<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/docs.swift.org\/swift-book\/documentation\/the-swift-programming-language\/opaquetypes\/\">https:\/\/docs.swift.org\/swift-book\/documentation\/the-swift-programming-language\/opaquetypes\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prerequisite Swift\u63d0\u4f9b\u5169\u7a2evalue type\u4f86\u96b1\u85cf\u5be6\u4f5c\u7d30\u7bc0: Note 1:\u901a\u5e38\u5728modu [&hellip;]<\/p>\n","protected":false},"author":139426785,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_postgate_lock_override":"inherit","_postgate_lock_mode":"inherit","_postgate_preview_mode":"inherit","_postgate_preview_limit":0,"_postgate_product_ids":[],"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_seo_schema_type":"","jetpack_seo_llms_txt_always_include":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_wpcom_ai_launchpad_first_post":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"{title}\n\n{excerpt}\n\n{url}","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[37324612,596263,55138170,1],"tags":[],"post_folder":[],"class_list":["post-9022","post","type-post","status-publish","format-standard","hentry","category-ios-development","category-swift","category-technology-sharing","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paR5vw-2lw","jetpack-related-posts":[{"id":3917,"url":"https:\/\/1989lifejourney.com\/?p=3917","url_meta":{"origin":9022,"position":0},"title":"Objective-C\u548cSwift\u7684\u5171\u540c\u9ede\u8207\u4e0d\u540c\u9ede","author":"Kevin","date":"8 12 \u6708, 2021","format":false,"excerpt":"Objective-C\u548cSwift\u7684\u5171\u540c\u9ede\u8207\u4e0d\u540c\u9ede \u4ee5\u4e0b\u8cc7\u6599\u4f86\u81ea[ref]\u7db2\u9801\u5167\u5bb9\uff0c\u9019\u88e1\u7d14\u7cb9\u505a\u91cd\u9ede\u6574\u2026","rel":"","context":"\u5728\u300cIOS Development\u300d\u4e2d","block_context":{"text":"IOS Development","link":"https:\/\/1989lifejourney.com\/?cat=37324612"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4899,"url":"https:\/\/1989lifejourney.com\/?p=4899","url_meta":{"origin":9022,"position":1},"title":"AnyObject v.s. Any in Swift","author":"Kevin","date":"24 3 \u6708, 2022","format":false,"excerpt":"AnyObject AnyObject can represent an instance of a\u2026","rel":"","context":"\u5728\u300cIOS Development\u300d\u4e2d","block_context":{"text":"IOS Development","link":"https:\/\/1989lifejourney.com\/?cat=37324612"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4965,"url":"https:\/\/1989lifejourney.com\/?p=4965","url_meta":{"origin":9022,"position":2},"title":"UITableView scroll position wonky when combined with a UISearchController and UINavigationBar","author":"Kevin","date":"27 3 \u6708, 2022","format":false,"excerpt":"\u00a0\u00a0 \u00a0 \u00a0 edgesForExtendedLayout = .top \/\/ view conte\u2026","rel":"","context":"\u5728\u300cIOS Development\u300d\u4e2d","block_context":{"text":"IOS Development","link":"https:\/\/1989lifejourney.com\/?cat=37324612"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4982,"url":"https:\/\/1989lifejourney.com\/?p=4982","url_meta":{"origin":9022,"position":3},"title":"Difference between value type and a reference type in iOS swift\ufffc","author":"Kevin","date":"29 3 \u6708, 2022","format":false,"excerpt":"\u4ee5\u4e0b\u8cc7\u6599\u7686\u53c3\u8003\u81eaRef1\uff0c\u9019\u88e1\u50c5\u4f5c\u500b\u4eba\u5b78\u7fd2\u6574\u7406: Definition of Value type \u2026","rel":"","context":"\u5728\u300cIOS Development\u300d\u4e2d","block_context":{"text":"IOS Development","link":"https:\/\/1989lifejourney.com\/?cat=37324612"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4009,"url":"https:\/\/1989lifejourney.com\/?p=4009","url_meta":{"origin":9022,"position":4},"title":"Static vs Dynamic Dispatch in Swift","author":"Kevin","date":"6 1 \u6708, 2022","format":false,"excerpt":"\u4ee5\u4e0b\u5167\u5bb9\u53c3\u8003\u81ea[Ref]\uff0c\u9019\u88e1\u50c5\u4f5c\u500b\u4eba\u6458\u8981\u6574\u7406: Method Dispatch\u5b9a\u7fa9: Method\u2026","rel":"","context":"\u5728\u300cIOS Development\u300d\u4e2d","block_context":{"text":"IOS Development","link":"https:\/\/1989lifejourney.com\/?cat=37324612"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4270,"url":"https:\/\/1989lifejourney.com\/?p=4270","url_meta":{"origin":9022,"position":5},"title":"About Type safety","author":"Kevin","date":"6 2 \u6708, 2022","format":false,"excerpt":"\u5b9a\u7fa9: \u578b\u5225\u5b89\u5168(type safety)\u53ef\u4ee5\u975c\u614b\u65b9\u5f0f\u5be6\u65bd\uff0c\u53ca\u65e9\u5728\u7de8\u8b6f\u6642\u671f\u5c31\u6355\u6349\u5230\u6f5b\u85cf\u7684\u932f\u8aa4\uff1b\u6216\u8005\u4ee5\u2026","rel":"","context":"\u5728\u300cIOS Development\u300d\u4e2d","block_context":{"text":"IOS Development","link":"https:\/\/1989lifejourney.com\/?cat=37324612"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/posts\/9022","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/users\/139426785"}],"replies":[{"embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9022"}],"version-history":[{"count":50,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/posts\/9022\/revisions"}],"predecessor-version":[{"id":9080,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/posts\/9022\/revisions\/9080"}],"wp:attachment":[{"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9022"},{"taxonomy":"post_folder","embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Fpost_folder&post=9022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}