{"id":6422,"date":"2024-08-02T19:13:23","date_gmt":"2024-08-02T11:13:23","guid":{"rendered":"https:\/\/t.n-years.com\/?p=6422"},"modified":"2024-08-02T19:13:23","modified_gmt":"2024-08-02T11:13:23","slug":"swift-%e5%92%8c-swiftui-%e9%87%8c%e7%9a%84%e5%ae%8f","status":"publish","type":"post","link":"https:\/\/t.n-years.com\/?p=6422","title":{"rendered":"Swift \u548c SwiftUI \u91cc\u7684\u5b8f"},"content":{"rendered":"<blockquote>\n<p>\u975e\u539f\u521b\u3001ChatGPT \u95ee\u7b54\u751f\u6210<br \/>\nSwift \u7684\u5b8f\uff08macros\uff09\u4e0e\u5176\u4ed6\u8bed\u8a00\u4e2d\u7684\u5b8f\u7565\u6709\u4e0d\u540c\u3002Swift \u4e0d\u76f4\u63a5\u652f\u6301\u4f20\u7edf\u7684\u5b8f\uff0c\u4f46\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e9b\u529f\u80fd\u548c\u5de5\u5177\u53ef\u4ee5\u8fbe\u5230\u7c7b\u4f3c\u7684\u6548\u679c\uff0c\u4f8b\u5982\u7f16\u8bd1\u5668\u6807\u8bb0\u548c\u6761\u4ef6\u7f16\u8bd1\u6307\u4ee4\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5728 Swift \u4e2d\u5e38\u89c1\u7684\u5b8f\u76f8\u5173\u529f\u80fd\u53ca\u5176\u4f5c\u7528\uff1a<\/p>\n<\/blockquote>\n<h3>1. <code>#if<\/code>, <code>#else<\/code>, <code>#elseif<\/code>, <code>#endif<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u7528\u4e8e\u6761\u4ef6\u7f16\u8bd1\uff0c\u6839\u636e\u4e0d\u540c\u7684\u6761\u4ef6\u7f16\u8bd1\u4ee3\u7801\u5757\u3002\u5e38\u7528\u4e8e\u5728\u4e0d\u540c\u7684\u5e73\u53f0\u6216\u7f16\u8bd1\u914d\u7f6e\u4e2d\u5305\u542b\u6216\u6392\u9664\u4ee3\u7801\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">#if DEBUG\nprint(\"Debug mode\")\n#else\nprint(\"Release mode\")\n#endif<\/code><\/pre>\n<p>\u8fd9\u4e2a\u793a\u4f8b\u4f1a\u6839\u636e\u662f\u5426\u5b9a\u4e49\u4e86 <code>DEBUG<\/code> \u6765\u51b3\u5b9a\u7f16\u8bd1\u54ea\u4e00\u90e8\u5206\u4ee3\u7801\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>2. <code>#available<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u68c0\u67e5 API \u6216\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u662f\u5426\u53ef\u7528\uff0c\u4ee5\u4fbf\u5728\u8fd0\u884c\u65f6\u9009\u62e9\u9002\u5f53\u7684\u4ee3\u7801\u8def\u5f84\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">if #available(iOS 14, *) {\n  print(\"iOS 14 or later\")\n} else {\n  print(\"Below iOS 14\")\n}<\/code><\/pre>\n<p>\u8fd9\u4e2a\u793a\u4f8b\u4f1a\u68c0\u67e5\u5f53\u524d\u8bbe\u5907\u662f\u5426\u8fd0\u884c\u5728 iOS 14 \u6216\u66f4\u9ad8\u7248\u672c\u4e0a\uff0c\u5e76\u6267\u884c\u76f8\u5e94\u7684\u4ee3\u7801\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>3. <code>#warning<\/code> \u548c <code>#error<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u7528\u4e8e\u7f16\u8bd1\u671f\u95f4\u53d1\u51fa\u8b66\u544a\u6216\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">#warning(\"This is a warning message\")<\/code><\/pre>\n<pre><code class=\"language-swift\">#error(\"This is an error message\")<\/code><\/pre>\n<p>\u4f7f\u7528 <code>#warning<\/code> \u548c <code>#error<\/code> \u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u63d2\u5165\u7f16\u8bd1\u671f\u95f4\u7684\u8b66\u544a\u6216\u9519\u8bef\u4fe1\u606f\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u6ce8\u610f\u6f5c\u5728\u7684\u95ee\u9898\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>4. <code>#file<\/code>, <code>#line<\/code>, <code>#column<\/code>, <code>#function<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u63d0\u4f9b\u7f16\u8bd1\u65f6\u7684\u6587\u4ef6\u540d\u3001\u884c\u53f7\u3001\u5217\u53f7\u548c\u51fd\u6570\u540d\uff0c\u5e38\u7528\u4e8e\u8c03\u8bd5\u548c\u65e5\u5fd7\u8bb0\u5f55\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">func logError(message: String, file: String = #file, line: Int = #line) {\n  print(\"Error: \\(message) at \\(file):\\(line)\")\n}\n\nlogError(message: \"Something went wrong\")<\/code><\/pre>\n<p>\u8fd9\u4e2a\u793a\u4f8b\u5728\u6253\u5370\u9519\u8bef\u65f6\u4f1a\u5305\u62ec\u6587\u4ef6\u540d\u548c\u884c\u53f7\uff0c\u5e2e\u52a9\u5b9a\u4f4d\u95ee\u9898\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>5. <code>@objc<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u6807\u8bb0 Swift \u4ee3\u7801\u53ef\u4ee5\u4e0e Objective-C \u8fdb\u884c\u4ea4\u4e92\u3002\u7528\u4e8e\u58f0\u660e\u90a3\u4e9b\u9700\u8981\u66b4\u9732\u7ed9 Objective-C \u7684 Swift \u7c7b\u548c\u65b9\u6cd5\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">@objc class MyClass: NSObject {\n  @objc func myMethod() {\n      print(\"This method is available to Objective-C\")\n  }\n}<\/code><\/pre>\n<p>\u8fd9\u4e2a\u793a\u4f8b\u4f7f <code>MyClass<\/code> \u548c <code>myMethod<\/code> \u53ef\u4ee5\u88ab Objective-C \u4ee3\u7801\u8bbf\u95ee\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>6. <code>@available<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u6807\u8bb0\u67d0\u4e2a\u7279\u6027\u3001\u7c7b\u3001\u65b9\u6cd5\u6216\u5c5e\u6027\u7684\u53ef\u7528\u6027\uff0c\u6307\u5b9a\u5728\u54ea\u4e9b\u7248\u672c\u4e2d\u53ef\u7528\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">@available(iOS 14.0, *)\nfunc newFeature() {\n  print(\"This feature is available on iOS 14 or later\")\n}<\/code><\/pre>\n<p>\u8fd9\u4e2a\u793a\u4f8b\u6807\u8bb0\u4e86 <code>newFeature<\/code> \u65b9\u6cd5\u4ec5\u5728 iOS 14.0 \u6216\u66f4\u9ad8\u7248\u672c\u4e0a\u53ef\u7528\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>7. <code>@discardableResult<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u6807\u8bb0\u4e00\u4e2a\u51fd\u6570\u7684\u8fd4\u56de\u503c\u662f\u53ef\u4ee5\u88ab\u5ffd\u7565\u7684\uff0c\u907f\u514d\u7f16\u8bd1\u5668\u53d1\u51fa\u672a\u4f7f\u7528\u8fd4\u56de\u503c\u7684\u8b66\u544a\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">@discardableResult\nfunc performAction() -> Bool {\n  \/\/ Perform some action\n  return true\n}<\/code><\/pre>\n<p>\u8fd9\u4e2a\u793a\u4f8b\u5141\u8bb8 <code>performAction()<\/code> \u65b9\u6cd5\u7684\u8fd4\u56de\u503c\u88ab\u5ffd\u7565\u800c\u4e0d\u4f1a\u4ea7\u751f\u7f16\u8bd1\u8b66\u544a\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>8. <code>@inline(__always)<\/code> \u548c <code>@inline(never)<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u5efa\u8bae\u7f16\u8bd1\u5668\u5728\u8c03\u7528\u4f4d\u7f6e\u5185\u8054\u51fd\u6570\uff0c\u4ee5\u4f18\u5316\u6027\u80fd\u6216\u907f\u514d\u5185\u8054\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">@inline(__always)\nfunc fastFunction() {\n  \/\/ Function code\n}<\/code><\/pre>\n<p>\u8fd9\u4e2a\u793a\u4f8b\u5efa\u8bae\u7f16\u8bd1\u5668\u59cb\u7ec8\u5728\u8c03\u7528\u4f4d\u7f6e\u5185\u8054 <code>fastFunction<\/code> \u51fd\u6570\uff0c\u4ee5\u63d0\u9ad8\u6027\u80fd\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u867d\u7136 Swift \u6ca1\u6709\u4f20\u7edf\u610f\u4e49\u4e0a\u7684\u5b8f\u7cfb\u7edf\uff0c\u4f46\u8fd9\u4e9b\u529f\u80fd\u548c\u6307\u4ee4\u63d0\u4f9b\u4e86\u7075\u6d3b\u7684\u7f16\u8bd1\u65f6\u63a7\u5236\u548c\u8c03\u8bd5\u652f\u6301\u3002<\/p>\n<h1>SwiftUI<\/h1>\n<p>\u5728 SwiftUI \u4e2d\uff0c<code>@Environment<\/code> \u662f\u4e00\u79cd\u4f9d\u8d56\u6ce8\u5165\u673a\u5236\uff0c\u7528\u4e8e\u4ece\u73af\u5883\u4e2d\u83b7\u53d6\u503c\u3002\u9664\u4e86 <code>@Environment<\/code>\uff0cSwiftUI \u8fd8\u6709\u5176\u4ed6\u51e0\u79cd\u5c5e\u6027\u5305\u88c5\u5668\uff0c\u5b83\u4eec\u5728\u4e0d\u540c\u7684\u573a\u666f\u4e2d\u63d0\u4f9b\u4e0d\u540c\u7684\u529f\u80fd\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u5c5e\u6027\u5305\u88c5\u5668\u53ca\u5176\u7528\u9014\uff1a<\/p>\n<h3>1. <code>@Environment<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u7528\u4e8e\u4ece\u73af\u5883\u4e2d\u83b7\u53d6\u5171\u4eab\u7684\u503c\u3002\u73af\u5883\u503c\u5728\u89c6\u56fe\u5c42\u7ea7\u7ed3\u6784\u4e2d\u5411\u4e0b\u4f20\u9012\uff0c\u5141\u8bb8\u5b50\u89c6\u56fe\u8bbf\u95ee\u7236\u89c6\u56fe\u63d0\u4f9b\u7684\u503c\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">struct ContentView: View {\n  @Environment(\\.colorScheme) var colorScheme\n\n  var body: some View {\n      Text(\"Current color scheme is \\(colorScheme == .dark ? \"Dark\" : \"Light\")\")\n  }\n}<\/code><\/pre>\n<p>\u8fd9\u4e2a\u793a\u4f8b\u83b7\u53d6\u5f53\u524d\u7684\u989c\u8272\u65b9\u6848\uff08\u6d45\u8272\u6216\u6df1\u8272\u6a21\u5f0f\uff09\u5e76\u663e\u793a\u76f8\u5e94\u7684\u6587\u672c\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>2. <code>@State<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u7528\u4e8e\u58f0\u660e\u4e00\u4e2a\u89c6\u56fe\u7684\u672c\u5730\u72b6\u6001\u3002\u5b83\u7528\u4e8e\u5b58\u50a8\u548c\u7ba1\u7406\u89c6\u56fe\u7684\u72b6\u6001\uff0c\u72b6\u6001\u53d1\u751f\u53d8\u5316\u65f6\u89c6\u56fe\u4f1a\u81ea\u52a8\u91cd\u65b0\u6e32\u67d3\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">struct CounterView: View {\n  @State private var count = 0\n\n  var body: some View {\n      VStack {\n          Text(\"Count: \\(count)\")\n          Button(\"Increment\") {\n              count += 1\n          }\n      }\n  }\n}<\/code><\/pre>\n<p>\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>count<\/code> \u662f\u4e00\u4e2a\u672c\u5730\u72b6\u6001\u53d8\u91cf\uff0c\u5f53\u6309\u94ae\u88ab\u70b9\u51fb\u65f6\uff0c<code>count<\/code> \u7684\u503c\u4f1a\u589e\u52a0\uff0c\u89c6\u56fe\u4f1a\u81ea\u52a8\u66f4\u65b0\u4ee5\u53cd\u6620\u65b0\u7684\u8ba1\u6570\u503c\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>3. <code>@Binding<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u7528\u4e8e\u5c06\u72b6\u6001\u7ed1\u5b9a\u5230\u7236\u89c6\u56fe\u4e2d\u7684\u72b6\u6001\u3002\u8fd9\u5141\u8bb8\u5b50\u89c6\u56fe\u8bfb\u5199\u7236\u89c6\u56fe\u4e2d\u7684\u72b6\u6001\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">struct ParentView: View {\n  @State private var isOn = false\n\n  var body: some View {\n      ToggleView(isOn: $isOn)\n  }\n}\n\nstruct ToggleView: View {\n  @Binding var isOn: Bool\n\n  var body: some View {\n      Toggle(\"Switch\", isOn: $isOn)\n  }\n}<\/code><\/pre>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>ToggleView<\/code> \u4f7f\u7528 <code>@Binding<\/code> \u7ed1\u5b9a\u5230 <code>ParentView<\/code> \u4e2d\u7684 <code>isOn<\/code> \u72b6\u6001\u3002\u8fd9\u4f7f\u5f97 <code>ToggleView<\/code> \u53ef\u4ee5\u76f4\u63a5\u4fee\u6539\u7236\u89c6\u56fe\u4e2d\u7684\u72b6\u6001\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>4. <code>@ObservedObject<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u7528\u4e8e\u89c2\u5bdf\u4e00\u4e2a <code>ObservableObject<\/code> \u5bf9\u8c61\u7684\u53d8\u5316\u3002\u5f53\u5bf9\u8c61\u4e2d\u7684\u6570\u636e\u53d1\u751f\u53d8\u5316\u65f6\uff0c\u89c6\u56fe\u4f1a\u91cd\u65b0\u6e32\u67d3\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">class CounterModel: ObservableObject {\n  @Published var count = 0\n}\n\nstruct CounterView: View {\n  @ObservedObject var model = CounterModel()\n\n  var body: some View {\n      VStack {\n          Text(\"Count: \\(model.count)\")\n          Button(\"Increment\") {\n              model.count += 1\n          }\n      }\n  }\n}<\/code><\/pre>\n<p>\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>CounterView<\/code> \u89c2\u5bdf <code>CounterModel<\/code> \u7684\u53d8\u5316\u3002\u5f53 <code>count<\/code> \u88ab\u66f4\u65b0\u65f6\uff0c\u89c6\u56fe\u4f1a\u81ea\u52a8\u5237\u65b0\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>5. <code>@StateObject<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u7528\u4e8e\u521b\u5efa\u548c\u7ba1\u7406\u4e00\u4e2a <code>ObservableObject<\/code> \u5b9e\u4f8b\uff0c\u5e76\u786e\u4fdd\u5728\u89c6\u56fe\u751f\u547d\u5468\u671f\u5185\u53ea\u521b\u5efa\u4e00\u6b21\u3002\u9002\u5408\u4e8e\u5728\u89c6\u56fe\u5185\u90e8\u6301\u6709\u548c\u521d\u59cb\u5316 <code>ObservableObject<\/code>\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">class CounterModel: ObservableObject {\n  @Published var count = 0\n}\n\nstruct CounterView: View {\n  @StateObject private var model = CounterModel()\n\n  var body: some View {\n      VStack {\n          Text(\"Count: \\(model.count)\")\n          Button(\"Increment\") {\n              model.count += 1\n          }\n      }\n  }\n}<\/code><\/pre>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>@StateObject<\/code> \u786e\u4fdd <code>CounterModel<\/code> \u4ec5\u5728 <code>CounterView<\/code> \u751f\u547d\u5468\u671f\u5185\u521b\u5efa\u4e00\u6b21\uff0c\u5e76\u4e14\u7ba1\u7406\u5176\u751f\u547d\u5468\u671f\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>6. <code>@EnvironmentObject<\/code><\/h3>\n<ul>\n<li>\n<p><strong>\u4f5c\u7528<\/strong>\uff1a\u7528\u4e8e\u4ece\u73af\u5883\u4e2d\u83b7\u53d6\u548c\u5171\u4eab\u4e00\u4e2a <code>ObservableObject<\/code> \u5b9e\u4f8b\u3002\u9002\u5408\u4e8e\u5728\u5e94\u7528\u4e2d\u7684\u591a\u4e2a\u89c6\u56fe\u4e4b\u95f4\u5171\u4eab\u6570\u636e\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre><code class=\"language-swift\">class UserSettings: ObservableObject {\n  @Published var isLoggedIn = false\n}\n\nstruct ContentView: View {\n  @EnvironmentObject var settings: UserSettings\n\n  var body: some View {\n      VStack {\n          Text(settings.isLoggedIn ? \"Logged In\" : \"Logged Out\")\n          Button(\"Toggle Login\") {\n              settings.isLoggedIn.toggle()\n          }\n      }\n  }\n}\n\n@main\nstruct MyApp: App {\n  var settings = UserSettings()\n\n  var body: some Scene {\n      WindowGroup {\n          ContentView()\n              .environmentObject(settings)\n      }\n  }\n}<\/code><\/pre>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>UserSettings<\/code> \u88ab\u6ce8\u5165\u5230\u73af\u5883\u4e2d\uff0c<code>ContentView<\/code> \u53ef\u4ee5\u8bbf\u95ee\u548c\u4fee\u6539 <code>UserSettings<\/code> \u7684\u72b6\u6001\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u8fd9\u4e9b\u5c5e\u6027\u5305\u88c5\u5668\u63d0\u4f9b\u4e86 SwiftUI \u4e2d\u5904\u7406\u72b6\u6001\u548c\u4f9d\u8d56\u6ce8\u5165\u7684\u7075\u6d3b\u6027\uff0c\u4f7f\u5f97\u6784\u5efa\u54cd\u5e94\u5f0f\u7528\u6237\u754c\u9762\u53d8\u5f97\u66f4\u5bb9\u6613\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u975e\u539f\u521b\u3001ChatGPT \u95ee\u7b54\u751f\u6210 Swift \u7684\u5b8f\uff08macros\uff09\u4e0e\u5176\u4ed6\u8bed\u8a00\u4e2d\u7684\u5b8f\u7565\u6709\u4e0d\u540c\u3002Swift \u4e0d\u76f4\u63a5&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/t.n-years.com\/?p=6422\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[135],"tags":[67,65],"class_list":["post-6422","post","type-post","status-publish","format-standard","hentry","category-135","tag-swift","tag-swiftui"],"_links":{"self":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6422"}],"version-history":[{"count":1,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6422\/revisions"}],"predecessor-version":[{"id":6424,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6422\/revisions\/6424"}],"wp:attachment":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}