master
hua 4 years ago
parent 8def448ca7
commit a0fa722e11
  1. 4
      Weibo.xcodeproj/project.pbxproj
  2. 1
      Weibo/LoginView.swift
  3. 48
      Weibo/TextView.swift

@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
43F5631C74EF810F4F999A66 /* Pods_WeiboTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 11A13FDA013FB0DA2E12E48F /* Pods_WeiboTests.framework */; };
7153B8FC24EDCB0D00D9C7E3 /* SendView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7153B8FB24EDCB0D00D9C7E3 /* SendView.swift */; };
7153B90024EDDFCE00D9C7E3 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7153B8FF24EDDFCE00D9C7E3 /* TextView.swift */; };
7153B90624EDF5B200D9C7E3 /* GrowingTextInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7153B90424EDF5B200D9C7E3 /* GrowingTextInputView.swift */; };
7153B90724EDF5B200D9C7E3 /* TextViewWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7153B90524EDF5B200D9C7E3 /* TextViewWrapper.swift */; };
716E9F0224E96288002CC6B8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 716E9F0124E96288002CC6B8 /* AppDelegate.swift */; };
@ -49,7 +48,6 @@
27B0BA649924BF20ED711CE6 /* Pods-Weibo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Weibo.debug.xcconfig"; path = "Target Support Files/Pods-Weibo/Pods-Weibo.debug.xcconfig"; sourceTree = "<group>"; };
6808829B1FA2E4D6EA25A6AA /* Pods-WeiboTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WeiboTests.release.xcconfig"; path = "Target Support Files/Pods-WeiboTests/Pods-WeiboTests.release.xcconfig"; sourceTree = "<group>"; };
7153B8FB24EDCB0D00D9C7E3 /* SendView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendView.swift; sourceTree = "<group>"; };
7153B8FF24EDDFCE00D9C7E3 /* TextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; };
7153B90424EDF5B200D9C7E3 /* GrowingTextInputView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GrowingTextInputView.swift; sourceTree = "<group>"; };
7153B90524EDF5B200D9C7E3 /* TextViewWrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextViewWrapper.swift; sourceTree = "<group>"; };
716E9EFE24E96288002CC6B8 /* Weibo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Weibo.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -158,7 +156,6 @@
isa = PBXGroup;
children = (
7153B90324EDF5B200D9C7E3 /* GrowinTextView */,
7153B8FF24EDDFCE00D9C7E3 /* TextView.swift */,
716E9F0124E96288002CC6B8 /* AppDelegate.swift */,
716E9F0324E96288002CC6B8 /* SceneDelegate.swift */,
716E9F0824E96288002CC6B8 /* ContentView.swift */,
@ -462,7 +459,6 @@
716E9F0924E96288002CC6B8 /* ContentView.swift in Sources */,
716E9F3924EA9175002CC6B8 /* LoginView.swift in Sources */,
7153B90624EDF5B200D9C7E3 /* GrowingTextInputView.swift in Sources */,
7153B90024EDDFCE00D9C7E3 /* TextView.swift in Sources */,
7153B8FC24EDCB0D00D9C7E3 /* SendView.swift in Sources */,
716E9F0724E96288002CC6B8 /* Weibo.xcdatamodeld in Sources */,
);

@ -132,7 +132,6 @@ struct UserView:View {
struct LoginView_Previews: PreviewProvider {
static var previews: some View {
// LoginView().environment(\.managedObjectContext, UserData.getContext()).environmentObject(UserData.getUser())
UserView()
}
}

@ -1,48 +0,0 @@
//
// TextView.swift
// SwiftUITextViewDemo
//
// Created by Simon Ng on 7/5/2020.
// Copyright © 2020 AppCoda. All rights reserved.
//
import SwiftUI
struct MultiLineTextView: UIViewRepresentable {
@Binding var text: String
@Binding var textStyle: UIFont.TextStyle
func makeUIView(context: Context) -> UITextView {
let textView = UITextView()
textView.delegate = context.coordinator
textView.font = UIFont.preferredFont(forTextStyle: textStyle)
textView.autocapitalizationType = .sentences
textView.isSelectable = true
textView.isUserInteractionEnabled = true
return textView
}
func updateUIView(_ uiView: UITextView, context: Context) {
uiView.text = text
uiView.font = UIFont.preferredFont(forTextStyle: textStyle)
}
func makeCoordinator() -> Coordinator {
Coordinator($text)
}
class Coordinator: NSObject, UITextViewDelegate {
var text: Binding<String>
init(_ text: Binding<String>) {
self.text = text
}
func textViewDidChange(_ textView: UITextView) {
self.text.wrappedValue = textView.text
}
}
}
Loading…
Cancel
Save