├── .swiftpm └── xcode │ ├── package.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── datt.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ └── datt.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── DPTagTextView.podspec ├── DPTagTextView ├── DPTagTextView.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ ├── datt.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── dharmesh.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── DPTagTextView.xcscheme │ └── xcuserdata │ │ ├── datt.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── dharmesh.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── DPTagTextView │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── DPTagTextView.h │ ├── DPTagTextView │ └── DPTagTextView.swift │ ├── Info.plist │ └── ViewController.swift ├── LICENSE ├── Package.swift └── README.md /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/xcuserdata/datt.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Datt1994/DPTagTextView/8cc8ee056760394035c928b36dcc5cf6cdf7026c/.swiftpm/xcode/package.xcworkspace/xcuserdata/datt.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /.swiftpm/xcode/xcuserdata/datt.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DPTagTextView.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DPTagTextView.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint DPTagDetectionTextView.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | s.name = "DPTagTextView" 19 | s.version = "2.5.1" 20 | s.summary = "Add & detect Tag/mention and tag search for Textview." 21 | 22 | # This description is used to generate tags and improve search results. 23 | # * Think: What does it do? Why did you write it? What is the focus? 24 | # * Try to keep it short, snappy and to the point. 25 | # * Write the description between the DESC delimiters below. 26 | # * Finally, don't worry about the indent, CocoaPods strips it! 27 | # s.description = <<-DESC 28 | # DESC 29 | 30 | s.homepage = "https://github.com/Datt1994/DPTagTextView" 31 | # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" 32 | 33 | 34 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 35 | # 36 | # Licensing your code is important. See http://choosealicense.com for more info. 37 | # CocoaPods will detect a license file if there is a named LICENSE* 38 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 39 | # 40 | 41 | s.license = "Apache 2.0" 42 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 43 | 44 | 45 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 46 | # 47 | # Specify the authors of the library, with email addresses. Email addresses 48 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 49 | # accepts just a name if you'd rather not provide an email address. 50 | # 51 | # Specify a social_media_url where others can refer to, for example a twitter 52 | # profile URL. 53 | # 54 | 55 | s.author = { "Datt1994" => "Datt1994@gmail.com" } 56 | # Or just: s.author = "Datt1994" 57 | # s.authors = { "Datt1994" => "email@address.com" } 58 | # s.social_media_url = "http://twitter.com/Datt1994" 59 | 60 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 61 | # 62 | # If this Pod runs only on iOS or OS X, then specify the platform and 63 | # the deployment target. You can optionally include the target after the platform. 64 | # 65 | 66 | # s.platform = :ios 67 | # s.platform = :ios, "5.0" 68 | 69 | # When using multiple platforms 70 | # s.ios.deployment_target = "5.0" 71 | # s.osx.deployment_target = "10.7" 72 | # s.watchos.deployment_target = "2.0" 73 | # s.tvos.deployment_target = "9.0" 74 | s.platform = :ios, "10.0" 75 | s.swift_version = '5.0' 76 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 77 | # 78 | # Specify the location from where the source should be retrieved. 79 | # Supports git, hg, bzr, svn and HTTP. 80 | # 81 | 82 | s.source = { :git => "https://github.com/Datt1994/DPTagTextView.git", :tag => s.version } 83 | 84 | 85 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 86 | # 87 | # CocoaPods is smart about how it includes source code. For source files 88 | # giving a folder will include any swift, h, m, mm, c & cpp files. 89 | # For header files it will include any header in the folder. 90 | # Not including the public_header_files will make all headers public. 91 | # 92 | 93 | s.source_files = 'DPTagTextView/DPTagTextView/DPTagTextView/DPTagTextView.swift' 94 | # s.exclude_files = "Classes/Exclude" 95 | 96 | # s.public_header_files = "Classes/**/*.h" 97 | 98 | 99 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 100 | # 101 | # A list of resources included with the Pod. These are copied into the 102 | # target bundle with a build phase script. Anything else will be cleaned. 103 | # You can preserve files from being cleaned, please don't preserve 104 | # non-essential files like tests, examples and documentation. 105 | # 106 | 107 | # s.resource = "icon.png" 108 | # s.resources = "Resources/*.png" 109 | 110 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 111 | 112 | 113 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 114 | # 115 | # Link your library with frameworks, or libraries. Libraries do not include 116 | # the lib prefix of their name. 117 | # 118 | 119 | # s.framework = "SomeFramework" 120 | # s.frameworks = "SomeFramework", "AnotherFramework" 121 | 122 | # s.library = "iconv" 123 | # s.libraries = "iconv", "xml2" 124 | 125 | 126 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 127 | # 128 | # If your library depends on compiler flags you can set them in the xcconfig hash 129 | # where they will only apply to your library. If you depend on other Podspecs 130 | # you can include multiple dependencies to ensure it works. 131 | 132 | # s.requires_arc = true 133 | 134 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 135 | # s.dependency "JSONKit", "~> 1.4" 136 | 137 | end 138 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C689FF4525EAF769002D9335 /* DPTagTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = C689FF4325EAF769002D9335 /* DPTagTextView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | C689FF4825EAF769002D9335 /* DPTagTextView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C689FF4125EAF769002D9335 /* DPTagTextView.framework */; }; 12 | C689FF4925EAF769002D9335 /* DPTagTextView.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C689FF4125EAF769002D9335 /* DPTagTextView.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 13 | C689FF5125EAFAEE002D9335 /* DPTagTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6CDA76C20BD4E8100F91211 /* DPTagTextView.swift */; }; 14 | C6A605E22074A59F005E5F45 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A605E12074A59F005E5F45 /* AppDelegate.swift */; }; 15 | C6A605E42074A59F005E5F45 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A605E32074A59F005E5F45 /* ViewController.swift */; }; 16 | C6A605E72074A59F005E5F45 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C6A605E52074A59F005E5F45 /* Main.storyboard */; }; 17 | C6A605E92074A59F005E5F45 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C6A605E82074A59F005E5F45 /* Assets.xcassets */; }; 18 | C6A605EC2074A59F005E5F45 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C6A605EA2074A59F005E5F45 /* LaunchScreen.storyboard */; }; 19 | C6CDA76D20BD4E8100F91211 /* DPTagTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6CDA76C20BD4E8100F91211 /* DPTagTextView.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | C689FF4625EAF769002D9335 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = C6A605D62074A59F005E5F45 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = C689FF4025EAF769002D9335; 28 | remoteInfo = DPTagTextView; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXCopyFilesBuildPhase section */ 33 | C689FF4A25EAF769002D9335 /* Embed Frameworks */ = { 34 | isa = PBXCopyFilesBuildPhase; 35 | buildActionMask = 2147483647; 36 | dstPath = ""; 37 | dstSubfolderSpec = 10; 38 | files = ( 39 | C689FF4925EAF769002D9335 /* DPTagTextView.framework in Embed Frameworks */, 40 | ); 41 | name = "Embed Frameworks"; 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXCopyFilesBuildPhase section */ 45 | 46 | /* Begin PBXFileReference section */ 47 | C689FF4125EAF769002D9335 /* DPTagTextView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DPTagTextView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | C689FF4325EAF769002D9335 /* DPTagTextView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DPTagTextView.h; sourceTree = ""; }; 49 | C689FF4425EAF769002D9335 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | C6A605DE2074A59F005E5F45 /* DPTagTextView-Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DPTagTextView-Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | C6A605E12074A59F005E5F45 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 52 | C6A605E32074A59F005E5F45 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 53 | C6A605E62074A59F005E5F45 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 54 | C6A605E82074A59F005E5F45 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 55 | C6A605EB2074A59F005E5F45 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 56 | C6A605ED2074A59F005E5F45 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | C6CDA76C20BD4E8100F91211 /* DPTagTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DPTagTextView.swift; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | C689FF3E25EAF769002D9335 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | C6A605DB2074A59F005E5F45 /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | C689FF4825EAF769002D9335 /* DPTagTextView.framework in Frameworks */, 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | /* End PBXFrameworksBuildPhase section */ 77 | 78 | /* Begin PBXGroup section */ 79 | C65F46D7237030D100B8062F /* DPTagTextView */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | C6CDA76C20BD4E8100F91211 /* DPTagTextView.swift */, 83 | ); 84 | path = DPTagTextView; 85 | sourceTree = ""; 86 | }; 87 | C689FF4225EAF769002D9335 /* DPTagTextView */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | C689FF4325EAF769002D9335 /* DPTagTextView.h */, 91 | C689FF4425EAF769002D9335 /* Info.plist */, 92 | ); 93 | path = DPTagTextView; 94 | sourceTree = ""; 95 | }; 96 | C6A605D52074A59F005E5F45 = { 97 | isa = PBXGroup; 98 | children = ( 99 | C6A605E02074A59F005E5F45 /* DPTagTextView */, 100 | C689FF4225EAF769002D9335 /* DPTagTextView */, 101 | C6A605DF2074A59F005E5F45 /* Products */, 102 | ); 103 | sourceTree = ""; 104 | }; 105 | C6A605DF2074A59F005E5F45 /* Products */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | C6A605DE2074A59F005E5F45 /* DPTagTextView-Example.app */, 109 | C689FF4125EAF769002D9335 /* DPTagTextView.framework */, 110 | ); 111 | name = Products; 112 | sourceTree = ""; 113 | }; 114 | C6A605E02074A59F005E5F45 /* DPTagTextView */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | C65F46D7237030D100B8062F /* DPTagTextView */, 118 | C6A605E12074A59F005E5F45 /* AppDelegate.swift */, 119 | C6A605E32074A59F005E5F45 /* ViewController.swift */, 120 | C6A605E52074A59F005E5F45 /* Main.storyboard */, 121 | C6A605E82074A59F005E5F45 /* Assets.xcassets */, 122 | C6A605EA2074A59F005E5F45 /* LaunchScreen.storyboard */, 123 | C6A605ED2074A59F005E5F45 /* Info.plist */, 124 | ); 125 | path = DPTagTextView; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXHeadersBuildPhase section */ 131 | C689FF3C25EAF769002D9335 /* Headers */ = { 132 | isa = PBXHeadersBuildPhase; 133 | buildActionMask = 2147483647; 134 | files = ( 135 | C689FF4525EAF769002D9335 /* DPTagTextView.h in Headers */, 136 | ); 137 | runOnlyForDeploymentPostprocessing = 0; 138 | }; 139 | /* End PBXHeadersBuildPhase section */ 140 | 141 | /* Begin PBXNativeTarget section */ 142 | C689FF4025EAF769002D9335 /* DPTagTextView */ = { 143 | isa = PBXNativeTarget; 144 | buildConfigurationList = C689FF4D25EAF769002D9335 /* Build configuration list for PBXNativeTarget "DPTagTextView" */; 145 | buildPhases = ( 146 | C689FF3C25EAF769002D9335 /* Headers */, 147 | C689FF3D25EAF769002D9335 /* Sources */, 148 | C689FF3E25EAF769002D9335 /* Frameworks */, 149 | C689FF3F25EAF769002D9335 /* Resources */, 150 | ); 151 | buildRules = ( 152 | ); 153 | dependencies = ( 154 | ); 155 | name = DPTagTextView; 156 | productName = DPTagTextView; 157 | productReference = C689FF4125EAF769002D9335 /* DPTagTextView.framework */; 158 | productType = "com.apple.product-type.framework"; 159 | }; 160 | C6A605DD2074A59F005E5F45 /* DPTagTextView-Example */ = { 161 | isa = PBXNativeTarget; 162 | buildConfigurationList = C6A605F02074A59F005E5F45 /* Build configuration list for PBXNativeTarget "DPTagTextView-Example" */; 163 | buildPhases = ( 164 | C6A605DA2074A59F005E5F45 /* Sources */, 165 | C6A605DB2074A59F005E5F45 /* Frameworks */, 166 | C6A605DC2074A59F005E5F45 /* Resources */, 167 | C689FF4A25EAF769002D9335 /* Embed Frameworks */, 168 | ); 169 | buildRules = ( 170 | ); 171 | dependencies = ( 172 | C689FF4725EAF769002D9335 /* PBXTargetDependency */, 173 | ); 174 | name = "DPTagTextView-Example"; 175 | productName = TagNameDetection; 176 | productReference = C6A605DE2074A59F005E5F45 /* DPTagTextView-Example.app */; 177 | productType = "com.apple.product-type.application"; 178 | }; 179 | /* End PBXNativeTarget section */ 180 | 181 | /* Begin PBXProject section */ 182 | C6A605D62074A59F005E5F45 /* Project object */ = { 183 | isa = PBXProject; 184 | attributes = { 185 | LastSwiftUpdateCheck = 0920; 186 | LastUpgradeCheck = 1220; 187 | ORGANIZATIONNAME = Datt; 188 | TargetAttributes = { 189 | C689FF4025EAF769002D9335 = { 190 | CreatedOnToolsVersion = 12.2; 191 | ProvisioningStyle = Automatic; 192 | }; 193 | C6A605DD2074A59F005E5F45 = { 194 | CreatedOnToolsVersion = 9.2; 195 | ProvisioningStyle = Manual; 196 | }; 197 | }; 198 | }; 199 | buildConfigurationList = C6A605D92074A59F005E5F45 /* Build configuration list for PBXProject "DPTagTextView" */; 200 | compatibilityVersion = "Xcode 8.0"; 201 | developmentRegion = en; 202 | hasScannedForEncodings = 0; 203 | knownRegions = ( 204 | en, 205 | Base, 206 | ); 207 | mainGroup = C6A605D52074A59F005E5F45; 208 | productRefGroup = C6A605DF2074A59F005E5F45 /* Products */; 209 | projectDirPath = ""; 210 | projectRoot = ""; 211 | targets = ( 212 | C6A605DD2074A59F005E5F45 /* DPTagTextView-Example */, 213 | C689FF4025EAF769002D9335 /* DPTagTextView */, 214 | ); 215 | }; 216 | /* End PBXProject section */ 217 | 218 | /* Begin PBXResourcesBuildPhase section */ 219 | C689FF3F25EAF769002D9335 /* Resources */ = { 220 | isa = PBXResourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | C6A605DC2074A59F005E5F45 /* Resources */ = { 227 | isa = PBXResourcesBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | C6A605EC2074A59F005E5F45 /* LaunchScreen.storyboard in Resources */, 231 | C6A605E92074A59F005E5F45 /* Assets.xcassets in Resources */, 232 | C6A605E72074A59F005E5F45 /* Main.storyboard in Resources */, 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXResourcesBuildPhase section */ 237 | 238 | /* Begin PBXSourcesBuildPhase section */ 239 | C689FF3D25EAF769002D9335 /* Sources */ = { 240 | isa = PBXSourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | C689FF5125EAFAEE002D9335 /* DPTagTextView.swift in Sources */, 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | C6A605DA2074A59F005E5F45 /* Sources */ = { 248 | isa = PBXSourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | C6A605E42074A59F005E5F45 /* ViewController.swift in Sources */, 252 | C6CDA76D20BD4E8100F91211 /* DPTagTextView.swift in Sources */, 253 | C6A605E22074A59F005E5F45 /* AppDelegate.swift in Sources */, 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | }; 257 | /* End PBXSourcesBuildPhase section */ 258 | 259 | /* Begin PBXTargetDependency section */ 260 | C689FF4725EAF769002D9335 /* PBXTargetDependency */ = { 261 | isa = PBXTargetDependency; 262 | target = C689FF4025EAF769002D9335 /* DPTagTextView */; 263 | targetProxy = C689FF4625EAF769002D9335 /* PBXContainerItemProxy */; 264 | }; 265 | /* End PBXTargetDependency section */ 266 | 267 | /* Begin PBXVariantGroup section */ 268 | C6A605E52074A59F005E5F45 /* Main.storyboard */ = { 269 | isa = PBXVariantGroup; 270 | children = ( 271 | C6A605E62074A59F005E5F45 /* Base */, 272 | ); 273 | name = Main.storyboard; 274 | sourceTree = ""; 275 | }; 276 | C6A605EA2074A59F005E5F45 /* LaunchScreen.storyboard */ = { 277 | isa = PBXVariantGroup; 278 | children = ( 279 | C6A605EB2074A59F005E5F45 /* Base */, 280 | ); 281 | name = LaunchScreen.storyboard; 282 | sourceTree = ""; 283 | }; 284 | /* End PBXVariantGroup section */ 285 | 286 | /* Begin XCBuildConfiguration section */ 287 | C689FF4B25EAF769002D9335 /* Debug */ = { 288 | isa = XCBuildConfiguration; 289 | buildSettings = { 290 | BUILD_LIBRARY_FOR_DISTRIBUTION = YES; 291 | CLANG_ENABLE_OBJC_WEAK = YES; 292 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 293 | CODE_SIGN_STYLE = Automatic; 294 | CURRENT_PROJECT_VERSION = 1; 295 | DEFINES_MODULE = YES; 296 | DEVELOPMENT_TEAM = ""; 297 | DYLIB_COMPATIBILITY_VERSION = 1; 298 | DYLIB_CURRENT_VERSION = 1; 299 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 300 | INFOPLIST_FILE = DPTagTextView/Info.plist; 301 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 302 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 303 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 304 | MARKETING_VERSION = 2.5.1; 305 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 306 | MTL_FAST_MATH = YES; 307 | PRODUCT_BUNDLE_IDENTIFIER = com.Datt.DPTagTextView; 308 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 309 | SKIP_INSTALL = YES; 310 | SWIFT_VERSION = 5.0; 311 | TARGETED_DEVICE_FAMILY = "1,2"; 312 | VERSIONING_SYSTEM = "apple-generic"; 313 | VERSION_INFO_PREFIX = ""; 314 | }; 315 | name = Debug; 316 | }; 317 | C689FF4C25EAF769002D9335 /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | BUILD_LIBRARY_FOR_DISTRIBUTION = YES; 321 | CLANG_ENABLE_OBJC_WEAK = YES; 322 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 323 | CODE_SIGN_STYLE = Automatic; 324 | CURRENT_PROJECT_VERSION = 1; 325 | DEFINES_MODULE = YES; 326 | DEVELOPMENT_TEAM = ""; 327 | DYLIB_COMPATIBILITY_VERSION = 1; 328 | DYLIB_CURRENT_VERSION = 1; 329 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 330 | INFOPLIST_FILE = DPTagTextView/Info.plist; 331 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 332 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 333 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 334 | MARKETING_VERSION = 2.5.1; 335 | MTL_FAST_MATH = YES; 336 | PRODUCT_BUNDLE_IDENTIFIER = com.Datt.DPTagTextView; 337 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 338 | SKIP_INSTALL = YES; 339 | SWIFT_VERSION = 5.0; 340 | TARGETED_DEVICE_FAMILY = "1,2"; 341 | VERSIONING_SYSTEM = "apple-generic"; 342 | VERSION_INFO_PREFIX = ""; 343 | }; 344 | name = Release; 345 | }; 346 | C6A605EE2074A59F005E5F45 /* Debug */ = { 347 | isa = XCBuildConfiguration; 348 | buildSettings = { 349 | ALWAYS_SEARCH_USER_PATHS = NO; 350 | CLANG_ANALYZER_NONNULL = YES; 351 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 352 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 353 | CLANG_CXX_LIBRARY = "libc++"; 354 | CLANG_ENABLE_MODULES = YES; 355 | CLANG_ENABLE_OBJC_ARC = YES; 356 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 357 | CLANG_WARN_BOOL_CONVERSION = YES; 358 | CLANG_WARN_COMMA = YES; 359 | CLANG_WARN_CONSTANT_CONVERSION = YES; 360 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 361 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 362 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 363 | CLANG_WARN_EMPTY_BODY = YES; 364 | CLANG_WARN_ENUM_CONVERSION = YES; 365 | CLANG_WARN_INFINITE_RECURSION = YES; 366 | CLANG_WARN_INT_CONVERSION = YES; 367 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 368 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 369 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 370 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 371 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 372 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 373 | CLANG_WARN_STRICT_PROTOTYPES = YES; 374 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 375 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 376 | CLANG_WARN_UNREACHABLE_CODE = YES; 377 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 378 | CODE_SIGN_IDENTITY = "iPhone Developer"; 379 | COPY_PHASE_STRIP = NO; 380 | DEBUG_INFORMATION_FORMAT = dwarf; 381 | ENABLE_STRICT_OBJC_MSGSEND = YES; 382 | ENABLE_TESTABILITY = YES; 383 | GCC_C_LANGUAGE_STANDARD = gnu11; 384 | GCC_DYNAMIC_NO_PIC = NO; 385 | GCC_NO_COMMON_BLOCKS = YES; 386 | GCC_OPTIMIZATION_LEVEL = 0; 387 | GCC_PREPROCESSOR_DEFINITIONS = ( 388 | "DEBUG=1", 389 | "$(inherited)", 390 | ); 391 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 392 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 393 | GCC_WARN_UNDECLARED_SELECTOR = YES; 394 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 395 | GCC_WARN_UNUSED_FUNCTION = YES; 396 | GCC_WARN_UNUSED_VARIABLE = YES; 397 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 398 | MTL_ENABLE_DEBUG_INFO = YES; 399 | ONLY_ACTIVE_ARCH = YES; 400 | SDKROOT = iphoneos; 401 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 402 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 403 | }; 404 | name = Debug; 405 | }; 406 | C6A605EF2074A59F005E5F45 /* Release */ = { 407 | isa = XCBuildConfiguration; 408 | buildSettings = { 409 | ALWAYS_SEARCH_USER_PATHS = NO; 410 | CLANG_ANALYZER_NONNULL = YES; 411 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 412 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 413 | CLANG_CXX_LIBRARY = "libc++"; 414 | CLANG_ENABLE_MODULES = YES; 415 | CLANG_ENABLE_OBJC_ARC = YES; 416 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 417 | CLANG_WARN_BOOL_CONVERSION = YES; 418 | CLANG_WARN_COMMA = YES; 419 | CLANG_WARN_CONSTANT_CONVERSION = YES; 420 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 421 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 422 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 423 | CLANG_WARN_EMPTY_BODY = YES; 424 | CLANG_WARN_ENUM_CONVERSION = YES; 425 | CLANG_WARN_INFINITE_RECURSION = YES; 426 | CLANG_WARN_INT_CONVERSION = YES; 427 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 428 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 429 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 430 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 431 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 432 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 433 | CLANG_WARN_STRICT_PROTOTYPES = YES; 434 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 435 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 436 | CLANG_WARN_UNREACHABLE_CODE = YES; 437 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 438 | CODE_SIGN_IDENTITY = "iPhone Developer"; 439 | COPY_PHASE_STRIP = NO; 440 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 441 | ENABLE_NS_ASSERTIONS = NO; 442 | ENABLE_STRICT_OBJC_MSGSEND = YES; 443 | GCC_C_LANGUAGE_STANDARD = gnu11; 444 | GCC_NO_COMMON_BLOCKS = YES; 445 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 446 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 447 | GCC_WARN_UNDECLARED_SELECTOR = YES; 448 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 449 | GCC_WARN_UNUSED_FUNCTION = YES; 450 | GCC_WARN_UNUSED_VARIABLE = YES; 451 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 452 | MTL_ENABLE_DEBUG_INFO = NO; 453 | SDKROOT = iphoneos; 454 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 455 | VALIDATE_PRODUCT = YES; 456 | }; 457 | name = Release; 458 | }; 459 | C6A605F12074A59F005E5F45 /* Debug */ = { 460 | isa = XCBuildConfiguration; 461 | buildSettings = { 462 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 463 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 464 | CODE_SIGN_STYLE = Manual; 465 | DEVELOPMENT_TEAM = ""; 466 | INFOPLIST_FILE = DPTagTextView/Info.plist; 467 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 468 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 469 | MARKETING_VERSION = 2.5.1; 470 | PRODUCT_BUNDLE_IDENTIFIER = "com.Datt.DPTagTextView-example"; 471 | PRODUCT_NAME = "$(TARGET_NAME)"; 472 | PROVISIONING_PROFILE_SPECIFIER = ""; 473 | SWIFT_VERSION = 5.0; 474 | TARGETED_DEVICE_FAMILY = "1,2"; 475 | }; 476 | name = Debug; 477 | }; 478 | C6A605F22074A59F005E5F45 /* Release */ = { 479 | isa = XCBuildConfiguration; 480 | buildSettings = { 481 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 482 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 483 | CODE_SIGN_STYLE = Manual; 484 | DEVELOPMENT_TEAM = ""; 485 | INFOPLIST_FILE = DPTagTextView/Info.plist; 486 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 487 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 488 | MARKETING_VERSION = 2.5.1; 489 | PRODUCT_BUNDLE_IDENTIFIER = "com.Datt.DPTagTextView-example"; 490 | PRODUCT_NAME = "$(TARGET_NAME)"; 491 | PROVISIONING_PROFILE_SPECIFIER = ""; 492 | SWIFT_VERSION = 5.0; 493 | TARGETED_DEVICE_FAMILY = "1,2"; 494 | }; 495 | name = Release; 496 | }; 497 | /* End XCBuildConfiguration section */ 498 | 499 | /* Begin XCConfigurationList section */ 500 | C689FF4D25EAF769002D9335 /* Build configuration list for PBXNativeTarget "DPTagTextView" */ = { 501 | isa = XCConfigurationList; 502 | buildConfigurations = ( 503 | C689FF4B25EAF769002D9335 /* Debug */, 504 | C689FF4C25EAF769002D9335 /* Release */, 505 | ); 506 | defaultConfigurationIsVisible = 0; 507 | defaultConfigurationName = Release; 508 | }; 509 | C6A605D92074A59F005E5F45 /* Build configuration list for PBXProject "DPTagTextView" */ = { 510 | isa = XCConfigurationList; 511 | buildConfigurations = ( 512 | C6A605EE2074A59F005E5F45 /* Debug */, 513 | C6A605EF2074A59F005E5F45 /* Release */, 514 | ); 515 | defaultConfigurationIsVisible = 0; 516 | defaultConfigurationName = Release; 517 | }; 518 | C6A605F02074A59F005E5F45 /* Build configuration list for PBXNativeTarget "DPTagTextView-Example" */ = { 519 | isa = XCConfigurationList; 520 | buildConfigurations = ( 521 | C6A605F12074A59F005E5F45 /* Debug */, 522 | C6A605F22074A59F005E5F45 /* Release */, 523 | ); 524 | defaultConfigurationIsVisible = 0; 525 | defaultConfigurationName = Release; 526 | }; 527 | /* End XCConfigurationList section */ 528 | }; 529 | rootObject = C6A605D62074A59F005E5F45 /* Project object */; 530 | } 531 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView.xcodeproj/project.xcworkspace/xcuserdata/datt.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Datt1994/DPTagTextView/8cc8ee056760394035c928b36dcc5cf6cdf7026c/DPTagTextView/DPTagTextView.xcodeproj/project.xcworkspace/xcuserdata/datt.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView.xcodeproj/project.xcworkspace/xcuserdata/dharmesh.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Datt1994/DPTagTextView/8cc8ee056760394035c928b36dcc5cf6cdf7026c/DPTagTextView/DPTagTextView.xcodeproj/project.xcworkspace/xcuserdata/dharmesh.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView.xcodeproj/xcshareddata/xcschemes/DPTagTextView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 57 | 58 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView.xcodeproj/xcuserdata/datt.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 16 | 17 | 18 | 20 | 33 | 34 | 35 | 37 | 50 | 51 | 52 | 54 | 67 | 68 | 69 | 71 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView.xcodeproj/xcuserdata/datt.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DPTagTextView-Example.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 1 11 | 12 | DPTagTextView.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | TagNameDetection.xcscheme 18 | 19 | orderHint 20 | 0 21 | 22 | TagNameDetection.xcscheme_^#shared#^_ 23 | 24 | orderHint 25 | 0 26 | 27 | 28 | SuppressBuildableAutocreation 29 | 30 | C689FF4025EAF769002D9335 31 | 32 | primary 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView.xcodeproj/xcuserdata/dharmesh.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | TagNameDetection.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // TagNameDetection 4 | // 5 | // Created by datt on 04/04/18. 6 | // Copyright © 2018 Datt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 55 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView/DPTagTextView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DPTagTextView.h 3 | // DPTagTextView 4 | // 5 | // Created by Datt Patel on 28/02/21. 6 | // Copyright © 2021 Datt. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for DPTagTextView. 12 | FOUNDATION_EXPORT double DPTagTextViewVersionNumber; 13 | 14 | //! Project version string for DPTagTextView. 15 | FOUNDATION_EXPORT const unsigned char DPTagTextViewVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView/DPTagTextView/DPTagTextView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DPTagTextView.swift 3 | // TagNameDetection 4 | // 5 | // Created by datt on 29/05/18. 6 | // Copyright © 2018 Datt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | // MARK: - DPTag 12 | public struct DPTag { 13 | public var id : String = UUID().uuidString 14 | public var name : String 15 | public var range: NSRange 16 | public var data : [String:Any] = [:] 17 | public var isHashTag: Bool = false 18 | public var customTextAttributes: [NSAttributedString.Key: Any]? = nil 19 | } 20 | 21 | // MARK: - DPTagTextViewDelegate 22 | public protocol DPTagTextViewDelegate { 23 | func dpTagTextView(_ textView: DPTagTextView, didChangedTagSearchString strSearch: String, isHashTag: Bool) 24 | func dpTagTextView(_ textView: DPTagTextView, didInsertTag tag: DPTag) 25 | func dpTagTextView(_ textView: DPTagTextView, didRemoveTag tag: DPTag) 26 | func dpTagTextView(_ textView: DPTagTextView, didSelectTag tag: DPTag) 27 | func dpTagTextView(_ textView: DPTagTextView, didChangedTags arrTags: [DPTag]) 28 | 29 | func textViewShouldBeginEditing(_ textView: DPTagTextView) -> Bool 30 | func textViewShouldEndEditing(_ textView: DPTagTextView) -> Bool 31 | func textViewDidBeginEditing(_ textView: DPTagTextView) 32 | func textViewDidEndEditing(_ textView: DPTagTextView) 33 | func textView(_ textView: DPTagTextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool 34 | func textViewDidChange(_ textView: DPTagTextView) 35 | func textViewDidChangeSelection(_ textView: DPTagTextView) 36 | func textView(_ textView: DPTagTextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool 37 | func textView(_ textView: DPTagTextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool 38 | } 39 | 40 | public extension DPTagTextViewDelegate { 41 | func dpTagTextView(_ textView: DPTagTextView, didChangedTagSearchString strSearch: String, isHashTag: Bool) {} 42 | func dpTagTextView(_ textView: DPTagTextView, didInsertTag tag: DPTag) {} 43 | func dpTagTextView(_ textView: DPTagTextView, didRemoveTag tag: DPTag) {} 44 | func dpTagTextView(_ textView: DPTagTextView, didSelectTag tag: DPTag) {} 45 | func dpTagTextView(_ textView: DPTagTextView, didChangedTags arrTags: [DPTag]) {} 46 | 47 | func textViewShouldBeginEditing(_ textView: DPTagTextView) -> Bool { true } 48 | func textViewShouldEndEditing(_ textView: DPTagTextView) -> Bool { true } 49 | func textViewDidBeginEditing(_ textView: DPTagTextView) {} 50 | func textViewDidEndEditing(_ textView: DPTagTextView) {} 51 | func textView(_ textView: DPTagTextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { true } 52 | func textViewDidChange(_ textView: DPTagTextView) {} 53 | func textViewDidChangeSelection(_ textView: DPTagTextView) {} 54 | func textView(_ textView: DPTagTextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { true } 55 | func textView(_ textView: DPTagTextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { true } 56 | } 57 | 58 | 59 | open class DPTagTextView: UITextView { 60 | 61 | // MARK: - Properties 62 | open var mentionSymbol: String = "@" 63 | open var hashTagSymbol: String = "#" 64 | open var textViewAttributes: [NSAttributedString.Key: Any] = { 65 | [NSAttributedString.Key.foregroundColor: UIColor.black, 66 | NSAttributedString.Key.font: UIFont.systemFont(ofSize: 15)] 67 | }() 68 | 69 | open var mentionTagTextAttributes: [NSAttributedString.Key: Any] = { 70 | [NSAttributedString.Key.foregroundColor: UIColor.blue, 71 | NSAttributedString.Key.backgroundColor: UIColor.lightGray, 72 | NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 15)] 73 | }() 74 | 75 | open var hashTagTextAttributes: [NSAttributedString.Key: Any] = { 76 | [NSAttributedString.Key.foregroundColor: UIColor.red, 77 | NSAttributedString.Key.backgroundColor: UIColor.lightGray, 78 | NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 15)] 79 | }() 80 | 81 | public private(set) var arrTags : [DPTag] = [] 82 | open var dpTagDelegate : DPTagTextViewDelegate? 83 | open var allowsHashTagUsingSpace : Bool = true 84 | 85 | private var currentTaggingRange: NSRange? 86 | private var currentTaggingText: String? { 87 | didSet { 88 | if let tag = currentTaggingText, tag != oldValue { 89 | dpTagDelegate?.dpTagTextView(self, didChangedTagSearchString:tag, isHashTag: isHashTag) 90 | } 91 | } 92 | } 93 | private var tagRegex: NSRegularExpression { 94 | try! NSRegularExpression(pattern: "(\(mentionSymbol)|\(hashTagSymbol))([^\\s\\K]+)") 95 | } 96 | private var isHashTag = false 97 | private var tapGesture = UITapGestureRecognizer() 98 | 99 | 100 | // MARK: - init 101 | required public init?(coder: NSCoder) { 102 | super.init(coder: coder) 103 | setup() 104 | } 105 | 106 | } 107 | 108 | // MARK: - Public methods 109 | public extension DPTagTextView { 110 | 111 | func addTag(allText: String? = nil, tagText: String, id: String = UUID().uuidString, data : [String:Any] = [:], customTextAttributes: [NSAttributedString.Key: Any]? = nil , isAppendSpace: Bool = true) { 112 | guard let range = currentTaggingRange else { return } 113 | guard let allText = (allText == nil ? text : allText) else { return } 114 | 115 | let origin = (allText as NSString).substring(with: range) 116 | let tag = isHashTag ? hashTagSymbol.appending(tagText) : tagText 117 | let replace = isAppendSpace ? tag.appending(" ") : tag 118 | let changed = (allText as NSString).replacingCharacters(in: range, with: replace) 119 | let tagRange = NSMakeRange(range.location, tag.utf16.count) 120 | 121 | let dpTag = DPTag(id: id, name: tagText, range: tagRange, data: data, isHashTag: isHashTag, customTextAttributes: customTextAttributes) 122 | arrTags.append(dpTag) 123 | for i in 0.. tagRange.location { 127 | location += replace.count - origin.count 128 | arrTags[i].range = NSMakeRange(location, length) 129 | } 130 | } 131 | 132 | text = changed 133 | updateAttributeText(selectedLocation: range.location+replace.count) 134 | dpTagDelegate?.dpTagTextView(self, didInsertTag: dpTag) 135 | dpTagDelegate?.dpTagTextView(self, didChangedTags: arrTags) 136 | isHashTag = false 137 | } 138 | 139 | func setTagDetection(_ isTagDetection : Bool, isEditable : Bool = false, isSelectable : Bool = false) { 140 | self.removeGestureRecognizer(tapGesture) 141 | if isTagDetection { 142 | tapGesture = UITapGestureRecognizer(target: self, action: #selector(tapOnTextView(_:))) 143 | tapGesture.delegate = self 144 | self.addGestureRecognizer(tapGesture) 145 | self.isEditable = isEditable 146 | self.isSelectable = isSelectable 147 | } else { 148 | self.isEditable = true 149 | self.isSelectable = true 150 | } 151 | } 152 | 153 | func setText(_ text: String?, arrTags: [DPTag]) { 154 | self.text = text 155 | self.arrTags = arrTags 156 | updateAttributeText(selectedLocation: -1) 157 | } 158 | /// This will remove all the previously cached tags. Always use this function to clear the textfields with actions 159 | func clearText() { 160 | self.text = "" 161 | self.arrTags.removeAll() 162 | } 163 | } 164 | 165 | 166 | // MARK: - Private methods 167 | private extension DPTagTextView { 168 | 169 | func setup() { 170 | delegate = self 171 | } 172 | 173 | @objc final func tapOnTextView(_ recognizer: UITapGestureRecognizer) { 174 | 175 | guard let textView = recognizer.view as? UITextView else { 176 | return 177 | } 178 | 179 | var location: CGPoint = recognizer.location(in: textView) 180 | location.x -= textView.textContainerInset.left 181 | location.y -= textView.textContainerInset.top 182 | 183 | let charIndex = textView.layoutManager.characterIndex(for: location, in: textView.textContainer, fractionOfDistanceBetweenInsertionPoints: nil) 184 | guard charIndex < textView.textStorage.length - 1 else { 185 | return 186 | } 187 | 188 | for i in 0 ..< arrTags.count { 189 | if arrTags[i].range.location <= charIndex && arrTags[i].range.location+arrTags[i].range.length > charIndex { 190 | dpTagDelegate?.dpTagTextView(self, didSelectTag: arrTags[i]) 191 | } 192 | } 193 | } 194 | 195 | func matchedData(taggingCharacters: [Character], selectedLocation: Int, taggingText: String) -> (NSRange?, String?) { 196 | var matchedRange: NSRange? 197 | var matchedString: String? 198 | let tag = String(taggingCharacters.reversed()) 199 | let textRange = NSMakeRange(selectedLocation-tag.count, tag.count) 200 | 201 | guard tag == mentionSymbol || tag == hashTagSymbol else { 202 | let matched = tagRegex.matches(in: taggingText, options: .reportCompletion, range: textRange) 203 | if matched.count > 0, let range = matched.last?.range { 204 | matchedRange = range 205 | matchedString = (taggingText as NSString).substring(with: range).replacingOccurrences(of: isHashTag ? hashTagSymbol : mentionSymbol, with: "") 206 | } 207 | return (matchedRange, matchedString) 208 | } 209 | 210 | matchedRange = nil//textRange 211 | matchedString = nil//isHashTag ? hashTag : symbol 212 | return (matchedRange, matchedString) 213 | } 214 | 215 | func tagging(textView: UITextView) { 216 | let selectedLocation = textView.selectedRange.location 217 | let taggingText = (textView.text as NSString).substring(with: NSMakeRange(0, selectedLocation)) 218 | let space: Character = " " 219 | let lineBrak: Character = "\n" 220 | var tagable: Bool = false 221 | var characters: [Character] = [] 222 | 223 | for char in Array(taggingText).reversed() { 224 | if char == mentionSymbol.first { 225 | characters.append(char) 226 | isHashTag = false 227 | tagable = true 228 | break 229 | } else if char == hashTagSymbol.first { 230 | characters.append(char) 231 | isHashTag = true 232 | tagable = true 233 | break 234 | } 235 | else if char == space || char == lineBrak { 236 | tagable = false 237 | break 238 | } 239 | characters.append(char) 240 | } 241 | 242 | guard tagable else { 243 | currentTaggingRange = nil 244 | currentTaggingText = nil 245 | return 246 | } 247 | 248 | let data = matchedData(taggingCharacters: characters, selectedLocation: selectedLocation, taggingText: taggingText) 249 | currentTaggingRange = data.0 250 | currentTaggingText = data.1 251 | } 252 | 253 | func updateAttributeText(selectedLocation: Int) { 254 | if text.isEmpty { arrTags.removeAll() } 255 | let attributedString = NSMutableAttributedString(string: text) 256 | attributedString.addAttributes(textViewAttributes, range: NSMakeRange(0, text.utf16.count)) 257 | arrTags.forEach { (dpTag) in 258 | guard let customTextAttributes = dpTag.customTextAttributes else { 259 | attributedString.addAttributes(dpTag.isHashTag ? hashTagTextAttributes : mentionTagTextAttributes, range: dpTag.range) 260 | return 261 | } 262 | attributedString.addAttributes(customTextAttributes, range: dpTag.range) 263 | } 264 | 265 | attributedText = attributedString 266 | if selectedLocation > 0 { selectedRange = NSMakeRange(selectedLocation, 0) } 267 | } 268 | 269 | func updateArrTags(range: NSRange, textCount: Int) { 270 | arrTags = arrTags.filter({ (dpTag) -> Bool in 271 | if dpTag.range.location < range.location && range.location < dpTag.range.location+dpTag.range.length { 272 | dpTagDelegate?.dpTagTextView(self, didRemoveTag: dpTag) 273 | return false 274 | } 275 | if range.length > 0 { 276 | if range.location <= dpTag.range.location && dpTag.range.location < range.location+range.length { 277 | dpTagDelegate?.dpTagTextView(self, didRemoveTag: dpTag) 278 | return false 279 | } 280 | } 281 | return true 282 | }) 283 | 284 | for i in 0 ..< arrTags.count { 285 | var location = arrTags[i].range.location 286 | let length = arrTags[i].range.length 287 | if location >= range.location { 288 | if range.length > 0 { 289 | if textCount > 1 { 290 | location += textCount - range.length 291 | } else { 292 | location -= range.length 293 | } 294 | } else { 295 | location += textCount 296 | } 297 | arrTags[i].range = NSMakeRange(location, length) 298 | } 299 | } 300 | 301 | currentTaggingText = nil 302 | dpTagDelegate?.dpTagTextView(self, didChangedTags: arrTags) 303 | } 304 | 305 | func addHashTagWithSpace(_ replacementText: String, _ range: NSRange) { 306 | if isHashTag && replacementText == " " && allowsHashTagUsingSpace { 307 | let selectedLocation = selectedRange.location 308 | let newText = (text as NSString).replacingCharacters(in: range, with: replacementText) 309 | let taggingText = (newText as NSString).substring(with: NSMakeRange(0, selectedLocation + 1)) 310 | if let tag = taggingText.sliceMultipleTimes(from: "#", to: " ").last { 311 | addTag(allText: newText, tagText: tag, isAppendSpace: false) 312 | } 313 | } 314 | } 315 | 316 | } 317 | 318 | // MARK: - UITextViewDelegate 319 | extension DPTagTextView: UITextViewDelegate { 320 | 321 | public func textViewDidChange(_ textView: UITextView) { 322 | tagging(textView: textView) 323 | updateAttributeText(selectedLocation: textView.selectedRange.location) 324 | dpTagDelegate?.textViewDidChange(self) 325 | } 326 | 327 | public func textViewDidChangeSelection(_ textView: UITextView) { 328 | tagging(textView: textView) 329 | dpTagDelegate?.textViewDidChangeSelection(self) 330 | } 331 | 332 | public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { 333 | addHashTagWithSpace(text, range) 334 | updateArrTags(range: range, textCount: text.utf16.count) 335 | return dpTagDelegate?.textView(self, shouldChangeTextIn: range, replacementText: text) ?? true 336 | } 337 | 338 | public func textViewShouldBeginEditing(_ textView: UITextView) -> Bool { 339 | dpTagDelegate?.textViewShouldBeginEditing(self) ?? true 340 | } 341 | 342 | public func textViewShouldEndEditing(_ textView: UITextView) -> Bool { 343 | dpTagDelegate?.textViewShouldEndEditing(self) ?? true 344 | } 345 | 346 | public func textViewDidBeginEditing(_ textView: UITextView) { 347 | dpTagDelegate?.textViewDidBeginEditing(self) 348 | } 349 | 350 | public func textViewDidEndEditing(_ textView: UITextView) { 351 | dpTagDelegate?.textViewDidEndEditing(self) 352 | } 353 | 354 | public func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { 355 | dpTagDelegate?.textView(self, shouldInteractWith: URL, in: characterRange, interaction: interaction) ?? true 356 | } 357 | 358 | public func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { 359 | dpTagDelegate?.textView(self, shouldInteractWith: textAttachment, in: characterRange, interaction: interaction) ?? true 360 | } 361 | 362 | } 363 | 364 | // MARK: - UIGestureRecognizerDelegate 365 | extension DPTagTextView : UIGestureRecognizerDelegate { 366 | public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { 367 | return true 368 | } 369 | } 370 | 371 | // MARK: - String extension 372 | internal extension String { 373 | func sliceMultipleTimes(from: String, to: String) -> [String] { 374 | components(separatedBy: from).dropFirst().compactMap { sub in 375 | (sub.range(of: to)?.lowerBound).flatMap { endRange in 376 | String(sub[sub.startIndex ..< endRange]) 377 | } 378 | } 379 | } 380 | } 381 | 382 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /DPTagTextView/DPTagTextView/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // TagNameDetection 4 | // 5 | // Created by datt on 04/04/18. 6 | // Copyright © 2018 Datt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | class ViewController: UIViewController { 13 | @IBOutlet weak var tagTextView: DPTagTextView! 14 | @IBOutlet weak var tbl: UITableView! 15 | @IBOutlet weak var lblTagName: UILabel! 16 | @IBOutlet weak var switchTagDetection: UISwitch! 17 | 18 | let isTagDetection = true 19 | let arrUsers : [String] = ["Datt Patel", "Dharmesh Shah","Arpit Dhamane","Nirzar Gandhi","Pooja Shah","Nilomi Shah","Pradip Rathod","Jiten Goswami"] 20 | let arrHashTag : [String] = ["random", "memes", "meme", "love", "photography", "art", "humor", "like", "follow", "funny", "photooftheday", "awesome"] 21 | var arrSearchUsers = [String]() 22 | 23 | override func viewDidLoad() { 24 | super.viewDidLoad() 25 | 26 | if (isTagDetection) { 27 | switchTagDetection.setOn(isTagDetection, animated: true) 28 | tagTextView.setTagDetection(true) 29 | 30 | let tag1 = DPTag(name: "Lorem Ipsum", range: NSRange(location: 41, length: 11)) 31 | let tag2 = DPTag(id: "567681647", name: "suffered", range: NSRange(location: 86, length: 9), data: ["withHashTag" : "#suffered"], isHashTag: true,customTextAttributes: [NSAttributedString.Key.foregroundColor: UIColor.green,NSAttributedString.Key.backgroundColor: UIColor.black, NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 15)]) 32 | let tag3 = DPTag(name: "humour", range: NSRange(location: 133, length: 7), isHashTag: true) 33 | 34 | tagTextView.setText("There are many variations of passages of Lorem Ipsum available, but the majority have #suffered alteration in some form, by injected #humour, or randomised words which don't look even slightly believable.", arrTags: [tag1, tag2, tag3]) 35 | 36 | } 37 | 38 | self.tagTextView.dpTagDelegate = self 39 | tbl.register(UITableViewCell.self, forCellReuseIdentifier: "cell") 40 | tbl.isHidden = true 41 | } 42 | 43 | @IBAction func tagDetectionSwitchAction(_ sender: UISwitch) { 44 | tagTextView.setTagDetection(sender.isOn) 45 | } 46 | @IBAction func btnClearAction(_ sender: UIButton) { 47 | tagTextView.setText(nil, arrTags: []) 48 | print(tagTextView.arrTags) 49 | } 50 | 51 | } 52 | // MARK:- DPTagTextViewDelegate 53 | extension ViewController : DPTagTextViewDelegate { 54 | 55 | func dpTagTextView(_ textView: DPTagTextView, didChangedTagSearchString strSearch: String, isHashTag: Bool) { 56 | 57 | if (strSearch.count == 0) { 58 | tbl.isHidden = true 59 | } else { 60 | tbl.isHidden = false 61 | } 62 | print(strSearch) 63 | arrSearchUsers = (isHashTag ? arrHashTag : arrUsers).filter({ (str) -> Bool in 64 | return str.lowercased().contains(strSearch.lowercased()) 65 | }) 66 | tbl.reloadData() 67 | 68 | } 69 | 70 | func dpTagTextView(_ textView: DPTagTextView, didInsertTag tag: DPTag) { 71 | 72 | } 73 | 74 | func dpTagTextView(_ textView: DPTagTextView, didRemoveTag tag: DPTag) { 75 | 76 | } 77 | 78 | func dpTagTextView(_ textView: DPTagTextView, didSelectTag tag: DPTag) { 79 | lblTagName.text = "\(tag.name) : \(tag.range) : \(tag.isHashTag ? tagTextView.hashTagSymbol : tagTextView.mentionSymbol)" 80 | } 81 | 82 | func dpTagTextView(_ textView: DPTagTextView, didChangedTags arrTags: [DPTag]) { 83 | 84 | } 85 | 86 | } 87 | // MARK:- UITableViewDelegate & UITableViewDataSource 88 | extension ViewController: UITableViewDelegate,UITableViewDataSource { 89 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 90 | return arrSearchUsers.count 91 | } 92 | 93 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 94 | let cell = tableView.dequeueReusableCell(withIdentifier: "cell")! 95 | 96 | cell.textLabel?.text = arrSearchUsers[indexPath.row] 97 | return cell 98 | } 99 | 100 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 101 | tagTextView.addTag(tagText: arrSearchUsers[indexPath.row]) 102 | tbl.isHidden = true 103 | } 104 | 105 | } 106 | 107 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.0 2 | // 3 | // Package.swift 4 | // 5 | 6 | import PackageDescription 7 | 8 | let package = Package(name: "DPTagTextView", 9 | platforms: [.iOS(.v10)], 10 | products: [.library(name: "DPTagTextView", 11 | targets: ["DPTagTextView"])], 12 | targets: [.target(name: "DPTagTextView", 13 | path: "DPTagTextView/DPTagTextView/DPTagTextView", 14 | publicHeadersPath: "")], 15 | swiftLanguageVersions: [.v5]) 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DPTagTextView 2 | [![Platform](https://img.shields.io/cocoapods/p/DPTagTextView.svg?style=flat)](http://cocoapods.org/pods/DPTagTextView) 3 | [![Language: Swift 5](https://img.shields.io/badge/language-swift5-f48041.svg?style=flat)](https://developer.apple.com/swift) 4 | [![License](https://img.shields.io/cocoapods/l/DPOTPView.svg?style=flat)](https://github.com/Datt1994/DPTagTextView/blob/master/LICENSE) 5 | [![Version](https://img.shields.io/cocoapods/v/DPTagTextView.svg?style=flat)](http://cocoapods.org/pods/DPTagTextView) 6 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 7 | 8 | Add & detect tag/mention using Textview. 9 | 10 | 11 | 12 | ![Demo](https://user-images.githubusercontent.com/19645535/109461826-ba059100-7a88-11eb-94db-a5f6b9a746b5.gif) 13 | 14 | 15 | ## Installation with CocoaPods 16 | 17 | [CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C & Swift. You can install it with the following command: 18 | 19 | ```bash 20 | $ gem install cocoapods 21 | ``` 22 | #### Podfile 23 | 24 | To integrate `DPTagTextView` into your Xcode project using CocoaPods, specify it in your `Podfile`: 25 | 26 | ```ruby 27 | source 'https://github.com/CocoaPods/Specs.git' 28 | platform :ios, '10.0' 29 | 30 | target 'TargetName' do 31 | use_frameworks! 32 | pod 'DPTagTextView' 33 | end 34 | ``` 35 | 36 | Then, run the following command: 37 | 38 | ```bash 39 | $ pod install 40 | ``` 41 | 42 | ## Installation with Carthage 43 | 44 | [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. 45 | 46 | You can install Carthage with [Homebrew](http://brew.sh/) using the following command: 47 | 48 | ```bash 49 | $ brew update 50 | $ brew install carthage 51 | ``` 52 | 53 | To integrate `DPTagTextView` into your Xcode project using Carthage, specify it in your `Cartfile`: 54 | 55 | ```ogdl 56 | github "Datt1994/DPTagTextView" 57 | ``` 58 | 59 | Run `carthage` to build the framework and drag the framework (`DPTagTextView.framework`) into your Xcode project. 60 | 61 | ## Installation with Swift Package Manager 62 | 63 | The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. 64 | 65 | To add the library as package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enter its repository URL `https://github.com/Datt1994/DPTagTextView.git` 66 | 67 | 68 | ## Add Manually 69 | 70 | Download Project and copy-paste `DPTagTextView.swift` file into your project 71 | 72 | 73 | ## How to use 74 | ![AddClass](https://user-images.githubusercontent.com/19645535/42803028-4d108e06-89c2-11e8-9b4a-8cbd92db385d.png) 75 | 76 | 👆Add DPTagTextView to UITextView Custom Class. 77 | 78 | 79 | ## Code 80 | 81 | **Set up** 82 | ```swift 83 | tagTextView.dpTagDelegate = self // set DPTagTextViewDelegate Delegate 84 | tagTextView.setTagDetection(true) // true :- detecte tag on tap , false :- Search Tags using mentionSymbol & hashTagSymbol. 85 | tagTextView.mentionSymbol = "@" // Search start with this mentionSymbol. 86 | tagTextView.hashTagSymbol = "#" // Search start with this hashTagSymbol for hashtagging. 87 | tagTextView.allowsHashTagUsingSpace = true // Add HashTag using space 88 | tagTextView.textViewAttributes = [NSAttributedString.Key.foregroundColor: UIColor.black, 89 | NSAttributedString.Key.font: UIFont.systemFont(ofSize: 15)] // set textview defult text Attributes 90 | tagTextView.mentionTagTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.blue, 91 | NSAttributedString.Key.backgroundColor: UIColor.lightGray, 92 | NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 15)] // set textview mentionTag text Attributes 93 | tagTextView.hashTagTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.red, 94 | NSAttributedString.Key.backgroundColor: UIColor.lightGray, 95 | NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 15)] // set textview hashTag text Attributes 96 | 97 | //Set pre text and tags 98 | let tag1 = DPTag(name: "Lorem Ipsum", range: NSRange(location: 41, length: 11)) 99 | let tag2 = DPTag(id: "567681647", name: "suffered", range: NSRange(location: 86, length: 9), data: ["withHashTag" : "#suffered"], isHashTag: true,customTextAttributes: [NSAttributedString.Key.foregroundColor: UIColor.green,NSAttributedString.Key.backgroundColor: UIColor.black, NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 15)]) 100 | let tag3 = DPTag(name: "humour", range: NSRange(location: 133, length: 7), isHashTag: true) 101 | 102 | tagTextView.setText("There are many variations of passages of Lorem Ipsum available, but the majority have #suffered alteration in some form, by injected #humour, or randomised words which don't look even slightly believable.", arrTags: [tag1, tag2, tag3]) 103 | 104 | //Clear textview 105 | tagTextView.setText(nil, arrTags: []) 106 | 107 | //Add tag replacing serached string 108 | //tagTextView.addTag(allText: String?, tagText: String, id: String, data: [String : Any], customTextAttributes: [NSAttributedString.Key : Any], isAppendSpace: Bool) 109 | tagTextView.addTag(tagText: "User Name") 110 | ``` 111 | 112 | **Delegate Methods** 113 | ```swift 114 | extension ViewController : DPTagTextViewDelegate { 115 | func dpTagTextView(_ textView: DPTagTextView, didChangedTagSearchString strSearch: String, isHashTag: Bool) { 116 | } 117 | 118 | func dpTagTextView(_ textView: DPTagTextView, didInsertTag tag: DPTag) { 119 | } 120 | 121 | func dpTagTextView(_ textView: DPTagTextView, didRemoveTag tag: DPTag) { 122 | } 123 | 124 | func dpTagTextView(_ textView: DPTagTextView, didSelectTag tag: DPTag) { 125 | } 126 | 127 | func dpTagTextView(_ textView: DPTagTextView, didChangedTags arrTags: [DPTag]) { 128 | } 129 | } 130 | ``` 131 | --------------------------------------------------------------------------------